[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1764956265710235.jpg (62 KB, 559x680)
62 KB
62 KB JPG
where-the-fuck-is-the-/wdg/-thread? edition
>>
i was looking for this thread to ask a question
i don't program javascript often, so help me out here
i'm writing a cpu intensive program using a webworker to run the compute and the main thread to draw the result as it comes
it appears that the worker is posting messages faster than the main thread can consume them causing the message queue to grow without bound (classic production-consumer message queue problem)
does the web worker api have any settings to wait on the message queue if it gets too large, or do i have to implement that shit myself with something like a handshake?
i've locked up my computer once today, and don't feel like putting it through that shit again, cause now i have to go through 9000 captchas before i get back to the nice and cozy easy 2 i was at
>>
>>108409537
I have not used Web Workers myself
>>
>>108409507
hello I am here for the Gemini capsule bro

hurry and invite me before I start gooning. You do NOT want my slunk making a mess in there
>>
>>108409537
did you write this post with gemini?
>>
>>108412057
no. fuck ai, and fuck you
>>
>>108412143
because gemini loves to say something is a "classic X problem". Maybe it's filtering out into the speech pattern of people now
>>
>>108412258
i kept trying to use those terms to search because web workers use message passing to communicate and that's the correct set of keywords that describe the issue, but search keeps returning bullshit
there's no guarantee whether the consumer or producer is the one that can't keep up, so i need the message queue to let the consumer/main thread sleep when the queue is empty or the producer/worker to sleep if the queue is full
i know how to solve it with mutexes and condition variables in C, but something tells me that's not going to happen in javascript

a little more detail, i'm trying to write an web-based emulator for a tile-based gpu i developed. i have the gpu emulation running in a worker, and need to push pixels to a canvas. it seems there is an OffscreenCanvas API that might be the way to go. i'll look into it tomorrow. any suggestions are welcome.
>>
>>108412287
there's also this if you want to build a mutex
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync
>>
>>108412287
ok, i decided to stay up late and used the OffscreenCanvas API and it works.
no more blown queues because all the work is being done in the worker and no messages have to be passed back to the main thread to render to the DOM

next question is this: what is the fastest way to loop the execution in my worker thread such that the canvas updates?
when i simply use a while(1) { run(); } loop, the canvas fails to update
i can use setInterval(run, 1), and while that works, it's slower than i want and seems to be frowned upon

once again, any suggestions? can i add some sort of function call to the while loop after run() that will do whatever the fuck has to happen to get the canvas to update?
>>
btw, i'm only drawing a single pixel each loop
while this is desirable from a cycle-accurate emulation perspective, it's reasonable to expect that i'll have to batch render e.g. a scanline at a time to get any measure of performance
real-time rendering of 60 frames a second isn't a goal here
as it stands, it takes about 70 seconds to render a 128x128 pixel display on my desktop, and could take up to x4 longer tor more to cycle through the 256x256 pixel display cycle
>>
last thing i'll ask tonight: anyone know of any good javascript hex editor widgets? i need a way to edit several different memories and expose the underlying byte arrays to the emulated gpu. a simple hex editor that lets me load up a default binary file would be ideal.
>>
>>108411714
I barely post in here though
>>108412057
https://geminiprotocol.net/
>>
>>108409507
>on the internet nobody knows that you're a cat
>>
>>108409537
I would guess this is could be something async/await would solve but take it with a grain of salt since I don't understine in fine detail what ur doing, conrinuing with the assumprion, it would make the thing slower, since it would wait for instructions one after the other, there's also some kind of await group if ur awaiting instructions in group, it will wait for all of them without the order mattering this might come in hand at some point to optimize
ping us in the thread if this helped cause it's an interesting case
>>
Some twat has been spamming my VPS with login attempts. I guess I need to harden my fail2ban settings
>>
>>108413013
I wonder if SHA key (first) to login (second) wouldn't defeat this problem at once
>>
>>108413162
I can't say I know what an SHA key is. I use an SSH key to log in to my VPS. I installed fail2ban and I thought the settings I added would ban IP addresses who repeatedly submit incorrect login attempts. I think I need to change my fail2ban settings though, I've tried a couple of things but I haven't explicitly defined a `banaction` so maybe that's why I keep seeing login attempts from the same IP address.
>>
>>108413293
>I use an SSH key to log in to my VPS
that's probs a sha key

anone here knows, does it make sense to restrict login with an sha key, would it solve anything?
>>
>>108413300
I dunno. Anyway I think I've solved the problem now by adding `banaction = ufw` to the file /etc/fail2ban/jail.local. Now when fail2ban wants to ban an IP address, it sets a ufw rule to block incoming connections from that IP address. While the IP address is banned I don't see any more login attempts from it in my sshd logs, because ufw blocks those attempts before they reach sshd. So now the bastard who was hammering my VPS with login attempts can't do anything. I guess it's good that I found this issue before someone managed to brute force their way into my VPS.
>>
Am I retarded if I write a web application in PHP without the use of any frameworks?



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.