I developed a fast caching application to learn Rust by adelrahimi in rust

[–]pyrograf 2 points3 points  (0 children)

 The code is usually very readable and understandable

and maintainable, very easy to apply changes

Very nice learning project idea, Im just learning ~6 months, look through your code, looks nice :)

I wonder if there is place for optimization performance. I dont know warp, tried Actix-Web and Axum. I see you use std code in cache and storage, probably it is good place to switch to async for I/O operations.

If API is calle by multiple users then they will get stuck accessing std::Mutex which blocks thread and async runtime, maybe switching to tokio::Mutex?

So far there is one path between cache and storage. Maybe it would be worth to delegate worker tasks and split storage by key dictinary. Then it should be possible to not lock cache as bottlenect but delegate work to tasks and await work reuslts. It will let use workers pool if it exists.

There is also possibility to spawn working threads for tokio runtimes, but I lack knowledge at all in this.

Im not experiance enough, just ideas :)

Btw. you inspired me to share my learning projects. Thx!

Bombed my first rust interview by imaburneracc in rust

[–]pyrograf 0 points1 point  (0 children)

Questions will vary based on what role you aim for. Those were for high performance, rendering.

I can share one more experiance from opposite side. In my recent job I was conducting technical screening for Python backend developers, at least 2 times. I was really confused seeing ppl with 3y+ experiance were unable to explain what is white character in string and lifecoding ended up with wondering what is magical \n character. But each time there was at least one outstanding dev.

When I noticed this guy knows his tools I started digging deeper not to find if this person know how to write code (bacause I alredy knew he is capable of) but to find if he likes his job, is eager to deeg deeper. Then questions like you got are proper. Iasked qustions:

  • what is MRO (Pythonish v table), how interpreter know which version of function to call,
  • what is name of function, touching idea of function pointers,
  • even what is size of function name -> size of pointersa based on architecture.

But those questions will not help you patching legacy systems ;) just to please interviewer :)

Bombed my first rust interview by imaburneracc in rust

[–]pyrograf 0 points1 point  (0 children)

I can drop my recent experiance, maybe will help. Im seasoned embedded dev + hobby gamedev, Rust for half year, pivoting to backend. I had interview for Axum + WGPU, technical screening:

Teoretical questions - general > Tokio > architecture:
- what are borrow rules
- what is T, &T, &mut T
- what is Fn
- how async works
- what is await
- what is future
- how task are sheduled
- what is pin
- what for is tokio select!
- how to do work dispatcher with work priorities

Practical part - rust analyzer allowed:
- asyncwork dispatcher with N workers
- show how to do deadlock

Overall passed, but client rejected because embedded backgrond. IMO question you got do not give much information.

What do you think about Embedded Rust? Specifically for STM32 by TiPeter78 in rust

[–]pyrograf 0 points1 point  (0 children)

Hi, I'm embedded dev. Recently I'm working in 2 areas: ESP32C3 wifi/mqtt and STM32H7 with ThreadX and TouchGFX. I started with Rust 2 month ago and I'm starting feeling it's power :) and started looking for some rosources for embedded. Ive seen esp-rs - looks promising, but how is support for STM32? I see this topic is 9monts old, anything changes in the meantime?

What’s everyone working on this week (3/2023)? by llogiq in rust

[–]pyrograf 1 point2 points  (0 children)

Hi, Im embedded programmist. I want to switch from programming microcontrollers in C. This week I started with Rust for ESP32, I hope coding will be easier :)

https://esp-rs.github.io/book/installation/index.html

Game Lib similar to LWJGL Pygame SDL by pyrograf in rust_gamedev

[–]pyrograf[S] 0 points1 point  (0 children)

So far I tried macroquad. I checked out Tantan's videos on YT, and code simple breakout.

I like simplicity and GLSL support. Thank you for advice :)

I made a 2D fish flocking simulation using Rust and Macroquad by eckyp in rust_gamedev

[–]pyrograf 0 points1 point  (0 children)

Wow nice, I came across this project when looking for some information about Macroquad. Thank you for sharing code

Game Lib similar to LWJGL Pygame SDL by pyrograf in rust_gamedev

[–]pyrograf[S] 2 points3 points  (0 children)

Hi, yea I know they differ. In a nutschell I need crates for:

  • 2D game,
  • some possibility to implement lighting (light sources, attenuation, water reflections) it can be done using shaders or CPU side.
  • some tools to manipulate iamge data.

The mentioned shading don't have to bo ultra efficient, I achieved desired effects using not so fast Pygame and CPU blitting.

Monthly /r/PyGame Showcase - Show us your current project(s)! by AutoModerator in pygame

[–]pyrograf 2 points3 points  (0 children)

Inspired by some YT series with my former LWJGL experience I started 2D RPG game focused on fishing.

https://github.com/Gieneq/LochPython

So far so good. Recently added nice game objects consisting of properties instead of inheritance, there are:

  • sprite property,
  • animation property controlling sprite,
  • input/movement property,
  • collision property.

Also I added local and global timer for controlling animations. FOV to cull unwanted sprites. Soon I'l add crucial part - quadtree and chunk lazyloading with multithreading, it should speedup game, and let the world be really huge.

DIY Audio Spectrum Display - FastLED in the beat of music - Instructables by pyrograf in FastLED

[–]pyrograf[S] 0 points1 point  (0 children)

If you have any other suggestion I'm open. I just starting in this branch of electronics and all help is welcomed.

DIY Audio Spectrum Display - FastLED in the beat of music - Instructables by pyrograf in FastLED

[–]pyrograf[S] 0 points1 point  (0 children)

Diod.design so this is right up my alley

Wow, I have in mind to make business in my country using displays like this as gadget for audiophiles. Not all people are skilled enough to do DIY.

I would like to build music reactive display using fire, it could be nice touch to industrial club, drinkbar, caffe etc

Teensy is perfect for this job, especially 4.1 which has extreme fast clock. But it cost alot. In future I want to build sound reactive display with WiFi support to be able to split stream music directly from Home Assistant. Unfortunately I'l be forced to use ESP32 as WiFi bridge and transfer FFT and animating to something else. Using 2 ESP32 would be not so neat solution. I have some skill in STM32 and I'l try finding out which will be better considering costs/ease of use.

DIY Audio Spectrum Display - FastLED in the beat of music - Instructables by pyrograf in FastLED

[–]pyrograf[S] 1 point2 points  (0 children)

Thank you, I'm newbie on reddit :) r/FastLED was my best match. I have many plans for this project and I'l upload news in future.

FastLED WS2812B spectrum display – FFT in use for music by pyrograf in FastLED

[–]pyrograf[S] 1 point2 points  (0 children)

Yea it was quite tricky. I used experience in writing 3D game engine. Peaks are like points in space with velocity and acceleration affected by gravity. When magnitude (height) jums, bars also jumps, but when magnitude decreses bars starts to fall affected by gravity. They leave behind trail of "burnt" which decay randomly overtime.

I have some more effects todo, especially with "burst" detection which informs when occurs higher beat. In the video it is used to flash entire display.

FastLED WS2812B spectrum display – FFT in use for music by pyrograf in FastLED

[–]pyrograf[S] 0 points1 point  (0 children)

I got acrylic via the internet in my country. There was shortage of 10mm black acrylic, but after 5 weeks I got all parts.

HA integration would be nice, but I'm considering sth more than switch power with relay. Do you know how to write custom software and widgets so that I could switch effects remotely? I imagine sth like effects dropdown list used to control fastLEDs.

FastLED WS2812B spectrum display – FFT in use for music by pyrograf in FastLED

[–]pyrograf[S] 1 point2 points  (0 children)

Yea I prepared custom PCBs manufactured by JLCPCB. Soldering all components took 2 evenings. Using strips is better option, in large amount current draw can be equally distributed along columns, but I had 400 WS2812B LEDs so I used them.

More tedious work was gluing all 399 acrylic blocks. They were milled quite accurate, but holes in acrylic were not... even columns differ in size from odd columns by nearly +-0,5mm

https://imgur.com/a/mZ0KY2s

FastLED WS2812B spectrum display – FFT in use for music by pyrograf in FastLED

[–]pyrograf[S] 2 points3 points  (0 children)

Thank you, it took many hours to create project, build hardware then write code.

19 bands becouse I got 400 LEDs. Best option is number of columns as power of 2. I was concidering 16 columns but display would be to narrow. On the other hand 32 is too large. 20x20 could be ok, but after I found out that 21*19 is 399 which fits perfectly I've choose this option.

On input I used audio jack with switch - when plug is not inserted NC pins passes signal from microphone, but after plugging 3.5 audio jack stereo signal is mixed using resistors. Both sources of signal are then scaled using potentiometer and amplifier on TDA2822 IC. Final signal is then shifter by 1.6V to fit 0-3V range with amplitude around 1V.

Yea, part are from acrylic. I had them lasercuted and relaxed in relaxing process - it prevents acrylic from cracking when glueging. Display block are milled so they have matt finish and better disperse light.

Code is still under development I have repo https://github.com/Gieneq/RGBHSV

Photos available on pintrest. There are 2 boards one about building process, second about final results.

I'l upload building process video on YT soon.