[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 / qa] [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


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


What are you working on, /g/?

previous >>101076153
>>
File: file.png (58 KB, 924x832)
58 KB
58 KB PNG
>>101101055
4-bit drum machine/sequencer for the commodore 64/128 using 6502 assembler.
  =========================================== ==== === == =
| driver code | 653 bytes
| sample list | 60 bytes
| pattern list | 32 bytes
| pattern data | 130 bytes
| sample data | 48259 bytes
=========================================== ==== === == =
>>
>>101101055
Hello dpt

I just learned gnu make, it is the only makefiles utility i know, i am from now on going to shill it and shit on cmake anytime anyone asks for a make utility.
>>
>>101101055
making an interpreter, because I want to try out that type safety idea I've been having lately
>>
>>101100076 (me)
coc-pyright is slow but it can find the reference. I mistakenly thought I had switched to Pylyzer, but I was still using coc-jedi. Pylyzer couldn't find fullcontrol.
>>
>>101099058
I don't.
>>
>>101101711
>that type safety idea I've been having lately
what's your idea?
>>
>>101101373

unbelievably based
>>
File: Screenshot (6).png (3.1 MB, 1916x1080)
3.1 MB
3.1 MB PNG
>>101101055

been learning C# the past two weeks. First programming language, moving on to methods. Im really enjoying it so far.
>>
>>101102772
apologies if you've already read this, I explained my base idea here a few days ago but I don't feel like finding the post.
long story short, I read about dependent types some time ago and I wanted to try to expose some of their advantages without needing to write formal proofs. my plan is to let the user define all the type invariants that he wants, and they'll be treated as asserts during execution. you don't have compile time guarantees and they risk significantly slowing down execution, but my lang is going to be interpreted anyways + it's easy to make the user opt out of these asserts with an execution flag
an example (still deciding on the syntax):

// a shape definition resembles a function declaration. the @ argument indicates which base type the defined shape references.
Shape MagicSet(@elems: Set<int>, size: int, sum: int) = {
SIZE_IS_CONST: Equal(size, len(elems));
EVERY_EL_HAS_SUM-RECIPROCAL: ForAll(elems |n|).Exists(elems |m|).SuchThat(n + m == sum);
}
};
>>
>>101103272
>and they'll be treated as asserts during execution
well, it is an interpreter, you are cheating.
The whole thing is that you are not going to create overhead by having the compiler run an algorithm predicting wether there is a chance for the type safety being broken
>>
>>101103272
>type safety
>we fill your code with crashes
>>
what are some good resources (textbooks, articles) for learning the theory behind threads, how to properly use them, how to tell when they would be useful, how not to abuse them, best practices, and the like? First principals stuff, but for someone who otherwise already knows how to program.

I'm trying to google for them and only finding resources that either explain threads as if you're already super familiar with them and their caveats and just need to know how to thread in a specific language; or just tell you how to make threads work and have at it champ (like handing a loaded handgun to a 6 year old)
>>
>https://github.com/codecrafters-io/build-your-own-x

Doing these projects wouldn't be "tutorial hell" ?
>>
>>101103697
There is no thread theory because threads are implementation defined. There are different caveats depending on the implementation. Concurrency is the theory. Multiple threads may or may not be involved.
Search for a "threading or concurrency in X" where X is your favorite language.
>>
https://pastebin.com/GNTxz1nr
cutting my dick off
>>
>>101103811
2 paths ahead:

>do them
>stay normgroid dev forever, grow to hate the technology you dont understand

>dont do them
>in stead shoot for the stars
>the stars (corpos) shoot back, you dont make anything but now you are a genius and love the tech that hates you
>eventually break-out
2 paths:
>no one cares
>enter cyber criminal gang
.
>someone cares
Do you hate the state?
>enter cyber criminal gang
>become old faggot trying to appeal to young normies for muh legacy

All of them are grim but you can look even higher
>>
i guess you can also become one of those retard leetcoders
>>
>>101101055
A Game Boy emulator written entirely in Svelte web frontend, including definitions of the hardware as component instances.

This is of course insane, but it should be an interesting stress test to see how efficiently all the state management reactive stuff works.
>>
Main Project: Vulkan with C Voxel Engine. Currently making marching cubes on compute shaders only.

Side Projects; many, but I’ll name 2 ,

1. Software Renderer in Assembly which will get hardware accelerated by PTX. Purpose is to learn 3D fundamentals and also learn assembly.

2. Symbolic Math App in Haskell. You type notation in and the app computes it. Like wolfram alpha. Goes from basic math to multi variable calculus. Purpose is to learn math and functional programming.
>>
>>101103411
>The whole thing is that you are not going to create overhead by having the compiler run an algorithm predicting wether there is a chance for the type safety being broken
for sure, though it's also true that "a chance" wouldn't be good enough, true type safety is either a compile time guarantee or it isn't.

>>101103453
my justification for adding this mechanism on top of the usual stuff like errors as values or try/catch is that these latter all well and good on paper, but people just use them locally for control flow and not to monitor the program state itself over time. crashing and rebooting your stuff is an underrated form of fault tolerance, if the situation allows it.
>>
yep, I've read it and replied to you then
why don't you try to make more complex types that ADTs that don't require proofs or truly dependent types and bite the bullet and try to write proofs? maybe it's not that bad, who knows? currently only a few have a clue of how easy/hard it is and even if it is hard, we need to understand why exactly and in what situations it's easy so that we can use them then
>>
I forgot to say
I'm working on designing a high-FPS frame grabber + blob identifier for work. I've identified that the grabber and the blob identifier can run in parallel to increase throughput drastically since the blob identifier can operate on the previous frame while the grabber gets the next frame. (the blob identifier is an order of magnitude slower than the grabber)

the problem is I come from the EE and embedded world where concurrency just isn't a thing (except in FPGAs) so I have no real concept of how to implement this.
My first blush forays into the matter have made me aware of a "producer/consumer" model using a queue that might work.

>>101103896
Thanks, searching for concurrency yields much better results.
>>
>>101104243
>>101103272
>>
>>101104194
you lack reading comprehension
>>
How do you deal with nocoders that relentlessly mock and criticize specific programmers by parroting what they've heard other developers say, despite them not understanding anything about programming?
>>
>>101104772
I remember that results are what matter and the fact that I have working code versus them starting their 9th hello world in their 17th language this week intrinsically makes me more valuable than they ever will be, and then I shut the fuck up, leave them to languish in their mediocrity, and get back to programming
>>
File: fun.jpg (275 KB, 1920x1080)
275 KB
275 KB JPG
>>101101373
>>
>>101104772
>nocoders
Fuck off
>>
>>101101055
i'm regarded but i want to learn linear algebra basics so i can understand the transformations i need to apply to my basic opengl program in order to get the camera working right.

could somebody PLEASE recommend me a tard-friendly handholding linear algebra tutorial?
>>
>>101104928
for you, King
https://www.amazon.com/Linear-Algebra-Undergraduate-Texts-Mathematics/dp/0387964126
>>
>>101104772
how do you feel about being a retard nigger who shoots shots at target millions of meters above him?
Thing is you cant engage in a counter culture because you are too stupid to even see the cracks in the established one, you criticize others by PROJECTING! nigger you are the only one who spends his days watching youtube or reading stackoverflow or whatever.
What is funny is that you got a high from thinking that
>lol i am so smart i totally read through them
you are a complete fool.

>>101104834
You cant even stand before me, software-nigger.
>>
>>101104243
I'm avoiding real dependent types because like I mentioned in another reply people are only willing to do so much to monitor the state of the program. the market share of languages adopting DTs is low enough that it shows that having to write proofs for types is deemed too much trouble, and at the same time the one's who're willing to put in the effort already have pretty good languages to use
>>
>>101104928
nigger learn geometry and read up on calculus (it is because we are programmers)
you dont need to read redundant shit, you have done this many times.
>>
>>101104973
>300 page textbook
i'm fucked, there's no way i'd be able to get through even a quarter of this book

>>101105010
what are you talking about? how is calculus going to help me with transformation matrices?
>>
>>101105030
>how is calculus going to help me with transformation matrices?
babygirl...
>>
>>101104194
>crashing and rebooting your stuff is an underrated form of fault tolerance
That's just Erlang.
>no but I want statically typed Erlang
https://learnyousomeerlang.com/types-or-lack-thereof
>One day Phil phoned me up and announced that a) Erlang needed a type system, b) he had written a small prototype of a type system and c) he had a one year’s sabbatical and was going to write a type system for Erlang and “were we interested?” Answer —“Yes.”
>Phil Wadler and Simon Marlow worked on a type system for over a year and the results were published in [20]. The results of the project were somewhat disappointing. To start with, only a subset of the language was type-checkable, the major omission being the lack of process types and of type checking inter-process messages.
>>
How the FUCK to I save scrapy data to a json file without it being ugly as fuck? I want to scrape simple stuff like names and urls, but the spider gives me a bunch of html code too
>>
>>101104772
>nocoders
Shouldn't you be whinging about this shit on reddit instead?
>>
>>101105382
maybe they sucked
>>
File: 1715313752898277.png (18 KB, 554x554)
18 KB
18 KB PNG
>>101105551
why would you complain about people compaining about nocoders on a programming thread, unless you were a nocoder yourself and therefore have no business being in this thread?
>>
>>101105598
>nocoder
Fuck off back to /vg/
>>
>>101105618
i have literally never been on that board in my life. how about you learn how to program instead of coping by shitting up /dpt/?
>>
>>101101055
I'm starting to think that I'll never be good at this
>>
At what point do you become a coder officially? After your first "hello world"? After solving fizzbuzz?
>>
>>101105636
Everybody in this thread knows how to program obviously you retard
Nocoder and nodev are used by some shitty video game dev thread and posting them here proves you're a collosal faggot who needs to lurk more before posting
>>
>>101105732
>Everybody in this thread knows how to program obviously you retard
first day on /dpt/ huh
>>
>>101105759
I didn't say well
>>
>>101105759
they may write java but they are still programming.
>>
>>101096504
Tons of program rely on things that characterise as UB, such as 2's complement in signed integers or representation of pointers.
Are you fucking braindead, or are you just a troll? My bad, those aren't mutually exclusive.
>>
>>101105732
Yes, thanks you saar. We are all the very bestest Java coders in this thread
>>
File: ui-demo.png (27 KB, 1600x860)
27 KB
27 KB PNG
Made a UI system for my game (making a game like dwarf fortress but not a mess), thoughts? Using C and SDL, which I've learned a lot of over the last few days (I'm just a dabbler).

https://pastebin.com/ewtSViLM
>>
File: lwkejrlw.jpg (267 KB, 1398x794)
267 KB
267 KB JPG
i did some time waste tests of async http clients against python's `httpbin`.. need more http clients
>>
>>101106796
Less messy than DF in which way?
>>
File: nig.png (139 KB, 1360x850)
139 KB
139 KB PNG
how do i avoid this?
>>
File: cyber hand.webm (3.86 MB, 300x300)
3.86 MB
3.86 MB WEBM
>>101101055
ASCII filter
>>
>>101101055
all of my projects are blocked from proceeding for one reason or another

REMINDER that your memory sticks go through usb and then pci, no i am not joking, it is as slow IO as it gets
>>
>>101107793
Cool. I made a pic to ascii program once, I doubt it'd be fast enough to keep up with a video file though
>>
>>101107735
you can put the arguments in arrays and do funny maths but what you are doing right now is better and is what the compiler would have put in the binary anyway, unless there is some way that placing more than 16 bytes on the stack in one go would not cause any problems
>>
>>101107793
rad, lose some weight though
>>
>>101107838
mine can't either, the output is sped up for fluidity, but I have an idea to move each pixel checking square that converts to a character into a single buffer so I can reduce the number of individual character printings.
>>
>>101107864
thanks good point, but it's a pretty good filter considering how obvious it is that I should lose weight even through it.
>>
>>101101055
>analyzing dmesg
>noticed my pcie spec was out of date (things are not in local bus 3.0 and gpt says it is the latest)
>pcie 5.0 is a thing
>it is 1300 pages
>the only 'public' difference with pci is still the uart-like full duplex vs using 8 conductors
public stands to mean "what anybody who has not sifted through the 1300 pages of nonsense at best knows"
They are just making competition impossible are they not?
>>
>>101101055
what youtube channels do you put on your secondary screen while programming?
>>
>>101108277
in steps (considering you are in shyton):
>configure the html parser with some templates you got by analyzing your games
>parser that extracts variables from the server-given docs (grim)
>write algorithms
and there you go... you can do it alone.
>>
>>101104254
FreeRTOS tasks are threads to me.
>>
>>101108285
none? i work best with complete silence, anything in my ears distracts me, i do play music nonetheless sometimes because enjoyment though
>>
>>101107827
Hmm> You can get pretty fast usb sticks nowadays, though I use a m.2 to usb enclosure, which is decently fast
>>
>>101108524
where i was going is more that ssd is as fast as usb
>>
can anyone provide a breakdown or even a link to a site or video that explains how software companies manage big projects? From what I understand they have zillions of "text files" that can be searched through with various utilities, and changes to said text files are manged through git. How much more is there to it? Why don't they use a database to manage their text files?
>>
>>101108711
what do you think git is?
>>
>>101108774
versioning software
>>
>>101101055
Note that ken and dennis are working while barne is kicked back up waiting for his compiler to finish running.
>>
>>101108815
funny magic words.
It just logs all modifications to files but it is a database manager at heart, with http incorporated too i guess
>>
>>101108711
>How much more is there to it?
There isn't.
>Why don't they use a database to manage their text files?
That requires technical competence and you pay your consultants to fix problems, not to learn how to fix the printer or use computers. You go and try convincing 100 people to do it "the right way" (tm).
>>
>>101108878
Ok interesting. I just read that its a database that uses the local file system. Seems like a unique concept since databases are usually just 1 file, right?

>>101108900
But git requires its own technical competence does it not?
>>
>>101108944
>But git requires its own technical competence does it not?
Assuming they use git and not a tool programmed to use it.
Assuming most drones do now just have the repo bookmarked and download shit manually.
Assuming they don't have Tom who grabs all the files from a remote disk at 5 pm and manually uploads them, so if you want to change anything you go through Tom.
>>
>>101104928
I got an a in linear algebra and I can tell you that no (or at least the vast majority of) linear algebra textbook won't help you. They are more for teaching you what a linear transformation is and it's consequences and relation with matrix algebra.
That being said a computer graphics book is what you are looking for. Grab, Lay's linear algebra book and ctrl-f for rotation and solve all those problem, if you can't then read the relevant chapter (try to prove each theorem yourself before reading the proof) After you've solved ctrl-f for further reading and check out the computer graphics books he links.
Or just google for what you want to know, find some article, check if it has references and then read it and if you understand then follow up with the references.
Or just google good introductory computer graphics books and then download them from libgen.
>>
TIL you can't run static binaries on macos anymore
>>
>>101104928
https://www.ljll.fr/~frey/papers/scientific%2520visualisation/Shoemake%2520K.,%2520Quaternions.pdf
Transformations are too broad, here is an article on rotations. If you want an opengl tutorial look at https://www.khronos.org/opengl/wiki/
And then just copy paste the examples into chatgpt and ask it for a reference.
This is the same book that was referenced in lay in my earlier post. So maybe just read Foley.
I just skimmed Foley and chapter 5 starts just about as basic as you can get so you should have no trouble.

All this being said, while everything I talked about in these 2 posts is "deep knowledge", opengl (and to a lesser extent but still very much vulcan) itself is dead. These systems only exist because of arbitrary restrictions made by graphics card manufacturers. You are better off using something like simp (from jai) or raylib were they interface with opengl for you, but will change the backend to something sane when it (if) comes along (which is looking more and more likely now that most of nvidia's revenue doesn't come from graphics.
>>
>>101107793
did you manually give each ascii char a black and white rating?
>>
>>101104928
multiply by the row space to transform something in to the column space, if it's invertible then you can go either way, then you just gotta learn the different spaces: local, world, camera, clip and screen space
>>
>>101109407
It doesn't look like every ascii character to me, at any rate, why would you do this when you could just count the number of white pixels per character in a bitmap.
>>
>>101109483
>count the number of white pixels per character in a bitmap
I asked to get this answer ! I didnt know this was possible. I guess the OS has a place where fonts are stores and you analyze those?
>>
>>101101055
any good resource to learn c?
>>
>>101109610
Yes. You open the ttf for your terminal font, take a screenshot (or multiple screenshots) convert that to a bitmap and chop it (terminal fonts are usually monospace so the multiple screenshots or chopping can be done by a program)
Then you convert it (if your screen shot program can't just give you) to a uncompressed pbm then you just use tr and wordcount and sort to get the most white to lest white characters. then you normalize that list and pick a good spread. Then you have the harder part of actually using them
>>
File: C.png (107 KB, 701x832)
107 KB
107 KB PNG
>>101109655
>>
File: 1718981122258969.jpg (187 KB, 506x508)
187 KB
187 KB JPG
HAHAHAHAH I MONKEYPATCHED YOUE SHIT CODE HAHAHAHA YOU CAN'T MAKE THIS SHIT UP
>>
>>101109655
>>101109772
First edition is better
>>
>>101107735
Use a matrix, and vec3, you dingus, also why isn't there an {x2, y2}

>OP
CUDA C Ideal MHD simulation of a screw-pinch. I have ~30,000 nulls to debug out of ~250,000 grid points
>>
>>101109190
good, your mental illness lasted too long.
>>
>>101101055
I have a c++ program like this
int main() {
int y = 0;
for(int i = 0; i < 10; ++i) {
float index = i * width + y;
}
}

if I set a breakpoint at float index could I change the evaluation of index? Say instead index = 2*i*width+y? I have been trying it via po in lldb but it seems its stuck in the loop that was captured so its constantly i=2 in the index assignment.
>>
>>101103811
at most spend a week on it move on then and skim it if you are ever stuck and need some advice. You really should just work on something you need or want me I liked generative art and fractals so thats what I learned first.
>>
>>101110657
>do something over span of months instead of minutes
ngmi in this zoomer world
>>
File: a-1709495163272384.jpg (82 KB, 1024x1018)
82 KB
82 KB JPG
how 2 use git?
>>
>>101111016
git add git commit git push
>>
>>101111016
git --help literally explains, dumb faggot
>>
>>101111016
magit
>>
>>101102479
hell, that sounds clever
>>
>>101104928
Someone linked this in another thread: https://minireference.com/static/tutorials/linear_algebra_in_4_pages.pdf
>>
>>101111791
>useless for noobs
>useless for pros
why
>>
I'm trying to learn C, but I get exhausted after 10 minutes and go back to browsing /g/.
>>
>>101111819
the internet fucked your attention span
>>
>>101111844
I am so glad I was born in the early 80s, and had all of the 90s to learn to code. I probably wouldn't be able to pull that off today, with how internet is frying everyone's brains.
>>
>>101111844
True. 4chins is the worst of all. I don't even use social media.
>>
>>101107735
s.perimeter = { {x1, y1}, {x2, y1}, ...};
also don't use .at nyagger
>>
>>101111819
>while, if, for. switch, enum, struct, types, functions
what is it you have a problem with? seriously i dont understand not being able to learn such a simple thing. I started out with python but duh i was slow at doing anything when i was handed lists, arrays, dynamic lists (???), 2000 libraries and a dick up the ass
>>
>>101111872
news.ycombinator.com is definitely teaching people bad ideas about computing. One's better off learning from a book than from those kooks.
>>
File: peperope.gif (980 KB, 305x320)
980 KB
980 KB GIF
>>101112419
>while, if, for. switch, enum, struct, types, functions
yeah that's easy enough
>pointers
it's over
>>
>>101112674
what is so hard about there being this block of space you are given that you can put things into? Seriously, did you just get memed into pointers being hard or something? is the '&' sign scary?
>>
>>101112674
>switch
>easy
send(to, from, count)
register short *to, *from;
register count;
{
register n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
} while (--n > 0);
}
}
>>
>>101101055
writing encryption because i have nothing better to do
>>
>>101112762
What's difficult? You just jump switch into the scope of the do loop.
>>
-----------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------
string_view_find 4469 ns 4456 ns 156368
strstr_find 6870 ns 6851 ns 102180
sse2_strstr_find 1913 ns 1908 ns 366952

Standard libraries are daily humiliation ritual.
>>
>>101111111
Who got it
>>
>>101112762
don't tell me you actually got filtered by duff's device?
>>
>>101112912
Tell me what the *'s mean
>>
>>101112935
they mean [0]
>>
Why do people who get filtered by c create so many memelangs for scientific education and research? I don't want to do DSP in "SCILAB" or "R" or "MATLAB" or "MATHEMATICA" fuck off.
>>
>>101112876
did you compile the standard library you're using for sse2?
>>
>>101112963
yes, my entire system is compiled with -O2 -march=native -flto
>>
>>101112994
damn
make sure you do your part though these are often open source
go to whatever their repo is and make an issue calling them a faggot, don't even tell them what's wrong with the code they should know
>>
>>101113006
I probably should, because I just checked and my glibc is compiled without multiarch, I disabled it, because I assumed that it would just build optimal code for my system
>>
>>101113006
>>101113020
based
>>
>>101101055
little color gradient app that lets me make a color gradient and then generate a code snippet to return any color on the gradient based on a 0.0-1.0 value.

Next is to add different color space options and HSV sliders
>>
>>101101055
C, Go, Haskell!
>>
>>101112994
>-O2
doesn't include -ftree-vectorize
>>101113006
damn it rajesh you never get tired of embarassing yourself
>>
>>101113384
>March native optimise doesn't vectorise
Unbelievably retarded
>>
>>101113384
my sse2 code isn't vectorized either
>>
>>101113484
>thinks -march=native is an optimization flag
grim
>>
>>101113679
I said march native optimise because he specified O2
>>
>>101113679
>>101113682
either way it's not relevant, glibc has handwritten asm implementation for everything, if -ftree-vectorize was needed for it to work, it would be extremely retarded
>>
>>101113690
so the handwritten version sucks?
>>
>>101113710
not sure, currently going through humiliation ritual of recompiling glibc with runtime detection for cpu because apparently there's no way to tune it for machine at compile time, but I know that strstr will be slower than my implementation anyway.
>>
File: humiliation ritual.png (191 KB, 1228x1150)
191 KB
191 KB PNG
recompiled glibc with multiarch USE flag, then recompiled my benchmarks, results are shocking
-----------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------
string_view_find 4534 ns 4515 ns 154707
strstr_find 6931 ns 6912 ns 101277
sse2_strstr_find 1911 ns 1907 ns 366892
>>
>>101101055
How to be a cracked programmer?
> Used ChatGPT for my assignments
> Got good marks because everyone else also used chatgpt, but didn't bother to change it to fit the requirements
> <200 ranked uni in Australia. >95% can't write a basic program without ChatGPT.

I just got c programming, a modern approach. I'm going to finish this and do some projects in pic real. Any advice for me, frens?
any blogs or poasts about becoming a cracked programmer and doing stuff that's deep and difficult would be helpful.
>>
>>101113937
just ask chatgpt
>>
>>101113937
link to picture source I need ideas
>>
>>101114034
encryption is fun
>>
>>101113922
gtoddlers BTFO
>>
>>101113953
This, ask chatgpt
>My password is <password>, please encrypt it
>>
File: 1703583282066166.png (93 KB, 912x688)
93 KB
93 KB PNG
lmao did Apple give up on the raytracing meme or what
>>
>>101114189
googled it and there's a rumour from two years ago about a setback on their chips needing to scale back its capability
>>
>>101114203
Sheesh I guess that one guy leaving their chip design team really did affect things
>>
a resource usage viewer for a raspberry pi that displays on a 320x480px screen
>>
>>101103811
>https://github.com/codecrafters-io/build-your-own-x
I did a couple of them, just do a few that interest you. I dropped some because the tutorials weren't what I was looking for, just pick and choose. But try and stick at least one to the end.
>>
>>101108285
second screen? youtube videos? Brother God speaks to me through the air conditioner and washing machine. He hums the machine instructions and I, his most devout scryer, translate these into text
>>
>The font shaping engine Harfbuzz, used in applications such as Firefox and Chrome, comes with a Wasm shaper allowing arbitrary code to be used to "shape" text.
Why
>>
File: file.png (117 KB, 803x501)
117 KB
117 KB PNG
My doujin categorization and search tools are completed! A basic version anyway, there's lots of room for improvement.
The categorization script makes an sqlite database with three tables, one for doujin IDs, one for tags and one for pairs of IDs and tags. The third table is significantly bigger than the other two obviously, would be nice to find a way around that but for now it's acceptable.
The search script takes a bunch of tags from the input and constructs a long sql SELECT statement out of them to get the IDs, and then makes a folder and copies the matching cbz files into it.
>>
[Jun23 14:33] module NIGGER_KILLER: Only one .gnu.linkonce.this_module section must exist.
[Jun23 14:34] module NIGGER_KILLER: Only one .gnu.linkonce.this_module section must exist.
[Jun23 14:37] module (missing .modinfo section or name field): Only one .gnu.linkonce.this_module section must exist.
[Jun23 14:40] module mod_test: Only one .gnu.linkonce.this_module section must exist.

#include <linux/slab.h>
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/init.h>

int mod_init(void);
void mod_exit(void);


void * pool_ptr;

int mod_init(void){
pr_info("modtest IS IN!\n");

pool_ptr = kzalloc(4096,0);
if (!pool_ptr) { pr_info("failed on the allocation!\n");}
else { pr_info("allocation was successful!\n");}

return 0;
}
void mod_exit(void){
kvfree(pool_ptr);
pr_info("modtest EXITING...\n");
}


module_init(mod_init);
module_exit(mod_exit); //wait how in the fuck?

MODULE_LICENSE("Proprietary");
MODULE_INFO(name,"mod_test");

what the fuck? i have tried taking the name off, adding other info, nothing works
>>
>>101112762
WTF... WHAAT! ... HOW!
>>
>>101104928
https://gamemath.com/
>>
File: frog_melty.jpg (47 KB, 750x1000)
47 KB
47 KB JPG
>>101114561
dude i swear to fucknig god i am like AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
>>
and the even funnier thing is that i dont know the layout of the gdt of linux so i might just copy the shit and append shit at random in some mapping because i dont think i can even do what i want to do with a the "raw memory" interface because linux is fucking pozzed and gay
>>
i cant even fucking do that without changing modes and doing other awful shit because i dont have access to the page the gdt is even on, god look at my system crashing due to missed interrupts from an awful apic driver
so much fucking fun, thank you linux

i totally do not wish death upon all of you fucking niggersdick suckers
>>
accepting discord tos is literally impossible on a laptop lmao, these fucknig niggers are mining crypto with javascript 100% god i hate corporations and their monkeys so much
>>
>>101115769
dunning kruger filtered
>>
File: ford-falcon-xc-cobra-1.jpg (138 KB, 768x512)
138 KB
138 KB JPG
Im trying to learn python but dont know what kind of programs to make?
>>
>>101117093
Is it your first programming language?
>>
>>101117108
Yes
>>
>>101117170
Python Crash Course is a guided project-based book that would spoonfeed you
>>
>>101117042
you are so retarded
am i supposed to go read linux' gdt layout? fucking where nigger? i dont think you even know how the gdt works to be spouting such nonsense, i can have selector 0 be the highest addresses of memory and any in between retard nigger, i can make the semgent size be whatever i want, go fucking read why throwing shit at the wall doesnt work
>>
>>101118059
Yes, it's something you clearly shouldn't be touching, retard. If you were capable of using it, you'd just write your own kernel, because setting up GDT is one of first steps you do.
>>
>>101118186
retard fucking nigger i need to reverse engineer drivers to have a kernel, nothing is fucking usable
>>
uhm dubs nigger you can go cut your dunning kruger dick off now sweaty

uhm trips
>>
>>101118200
not my problem if you're bad at programming
>>
File: 'my wife bro'.jpg (493 KB, 1079x987)
493 KB
493 KB JPG
AHHAHAHAHHAHAHAHAH
>>
>>101118231
>not my problem if i a retard nigger who cant do 1+1

>lol you cant shit out blindly working copies of proprietary drivers? nocodeshitter
>>
>>101118238
go back to [s4s]
>>
Why does my code not work? I intend to get the user to input a bunch of names and then print all of them at once, but after introducing the input for the second name, the program crashes.
#include <stdio.h>
#include <stdlib.h>

#define STR_SIZE 64

void get_input(char** b);

int main()
{
unsigned char arr_size = 5;

char* arr[arr_size];

for (char i = 0; i < arr_size; i++) {
printf("Name #%d: ", i + 1);
get_input(&(arr[i]));
}

for (char i = 0; i < arr_size; i++) {
puts(arr[i]);
}

return 0;
}

void get_input(char** b)
{
unsigned char alloc_size = 0;
char c;
char buff[STR_SIZE];
while (alloc_size < STR_SIZE && (c = getchar()) != '\n') {
buff[alloc_size] = c;
alloc_size++;
}
*b = malloc(sizeof(char) * (alloc_size + 1));
for (char i = 0; i < STR_SIZE; i++) {
*(*b + i) = buff[i];
}
(*b)[alloc_size] = '\0';
}

 malloc(): corrupted top size 
>>
>>101101055
Fucking hell, installing qt4 and getting it to build with qt creator is such a massive pain. I have decided to give up instead
>>
>>101118254
you can't even read free kernel code and figure out what you can do with its GDT
>>
>>101118263
>stalking modtranny
classic

>>101118274
1) stop doing the char double pointer shit, you can just pass arr
2)you are allocating memory for the string twice
>*b+i
i have no idea how the compiler will read that but it is likely no good.

>i is increasing and you are passing &(arr[i])
there is your culprit
>>
>>101118343
kys already
>>
>>101118433
do not use 4chan when speaking to the mirror
>>
hey man, it is the digits not me
>>
>>101117233
Spoon feed me ideas of things to make?
>>
>>101118450
i am happy as fuck, you can go kys on the other hand
>>
>>101118483
happy with being too retarded to use GDT?
>>
>>101118390
>1
It was a requirement, maybe I did not understand he problem?
>2
Where? I am supposed to malloc 5 different strings in 5 different postions, did I miss something?
>>
>>101118274
If you go through the code in a debugger you will find that the for loop in get_input should iterate up to alloc_size rather than STR_SIZE. Right now, you're always copying a STR_SIZE number of characters
>>
>>101118274
>*b = malloc(sizeof(char) * (alloc_size + 1));
> for (char i = 0; i < STR_SIZE; i++) {
should be i < alloc_size, not STR_SIZE
>>
>>101118562
Thanks anon, It works now. Well, kinda sonetimes one of the names has one of Its letters as a weord character for some reason, but I think this will do.
>>
>>101118545
>where
>allocating on the stack and heap
look, just

void in_string(char * string); //prototype cuz readable
#define maxlen ---
int main(){
char arr[maxlen]; //allocating memory for the string, arr is the lowest address of this memory
in_string(arr);
puts(arr);

return 0;
}
void in_string(char * string){
for (int i = 0; i < maxlen; ++i){ //getchar until newline or maxlen has been met
string[i] = getchar();
if (string[i] == '\n') string[i] = 0; return;
}
}
>>
it was an array of pointers... wahetver i dont read code i write it fuck this shit
>>
>>101118658
In doesnt do the same. Im allocating 5 different strings, not just one. Fix It like >>101118562 and >>101118608
said and see how It works.

Also the allocations on the stack is just a temporary buffer. I dont want to store 64 bytes for every 3 letter string.
>>
>>101104928
https://www.youtube.com/playlist?list=PLvv0ScY6vfd9zlZkIIqGDeG5TUWswkMox
Mike has you covered.
>>
>>101119131
Not him, but I was also looking for this. Thank you.
>>
>>101112762
I think I understand this - it just moves the values stored in the from array into to, which I assume does something not marked in this code snippet, because the to pointer is not incrementing and we’d just overwrite the value otherwise.

What’s confusing me a little is the purpose of the whole switch-do structure. What it does is clear enough: we batch the copied data into eights, and make sure we start midway through the first batch in case it’s not smoothly divisible by eight. The switch-case is really showing its roots as a glorified wrapper around goto here, and it could definitely be confusing to people more used to modern languages that demand explicit fall through or case tags in the top level of the switch’s code block.

But what I don’t get is what the eight-batching is even doing. Why not use a simple for loop? Did the compiler this snippet was written for optimize for loops poorly? Or is this something about registering the variables here?
>>
Web scraping is actually pretty fun. What's some cool shit I can do with Scrapy?
>>
>>101119171
No prob. The guy also has a bunch of other videos, I particularly like his first impression series, where he just picks a language and films himself trying to make sense of it (one can see he hasn't been prepared and kind of like just does it, with tons of moments where he's like confused and laughs nervously).
>>
>>101118480
No fuck off
>>
>>101119252
https://en.wikipedia.org/wiki/Duff%27s_device
>>
File: check-eds.png (495 KB, 479x900)
495 KB
495 KB PNG
>>101118222
>>
>>101119540
> Loop unrolling attempts to reduce the overhead of conditional branching needed to check whether a loop is done, by executing a batch of loop bodies per iteration.

That would be it. Probably an irrelevant technique in the vast majority of modern cases - evaluating a for loop condition is not where your performance is bottlenecked. Thanks!
>>
>>101118306
Fuck this (I tried again)
>>
File: f9cd92za9rtb1.jpg (957 KB, 3456x1944)
957 KB
957 KB JPG
>>101114034
here fren
>>
>>101119621
use tkinter instead, it just works
>>
writing a program which should run according to a cron schedule.
originally i wanted my program to be able to create its own entry in the user's crontab file, but i'm not sure if this is a good idea.

should my program be able to write to the crontab? or should it just run by itself in the background, and run its actual logic according to its own cron schedule?
>>
>>101120608
if you want to support retards who get filtered by cron, just tell them to use systemd timer
>>
>>101120634
i'm mainly concerned that my program will be touching the user's linux environment. maybe this is fine and a normal thing to do, but i've never written anything which needs to run on a schedule, but also is able to control when itself is run, so just wanted to see if i was going down a bad path.
>>
>>101120707
it shouldn't do anything on its own, nowadays there's no usecase for even self daemonizing programs anymore, just let your system handle it
>>
>>101120764
>nowadays there's no usecase for even self daemonizing programs anymore, just let your system handle it
could you elaborate on this? generally quite interested in it.
>>
>>101115407
>Soulless
http://www.iancgbell.clara.net/maths/index.htm
>>
>>101120764
so what is the correct way to daemonize then?
Warning: start-stop-daemon cannot check the exit status if
the process fails to execute for any reason. This is a last
resort, and is only meant for programs that either make no
sense forking on their own, or where it's not feasible to add
the code for them to do this themselves.
>>
>>101120707
>my program
Why would you be concerned... OOOOH by "my program" you mean calling a bunch of library functions you don't know that could depend on environment variables. LOL you aren't a programmer try >>/fglt/
>>
>>101120810
last time I had to write a system process config, all I needed to do was add
>command_background=true
in openrc init script for it and it automatically gets daemonized without any effort
>>101120939
never seen this
>>
I recently made a bash script that takes a batch of JPGs/PNGs, scans them for text with Tesseract OCR, and adds any detected text to the "Title" metadata tag.

I often have trouble finding specific memes in my collection so this makes it a lot easier, bc you can search for JPGs based on the text contained in their metadata in the Windows 10 file explorer. It should also work on Windows 11 although I haven't tested that as much.

https://github.com/thegoblingame/ScribeImage
>>
I was super motivated to git gud at programming, and just spend an insane amount of time learning, but then I jerked off, and now it's gone. All my motivation disappeared. What a fucking scam my dick is
>>
Tired of doing all my c projects in the terminal. What's an easy way to implement a pretty gui
>>
>>101121741
jerk me off faggot
>>
>>101101055
        uint32_t ** somepoint = (uint32_t **)argv;
for (uint32_t i = 0; i < argc; ++i){
if (somepoint[i][0] == 0x2D627573){

talking to gcc is like talking to a fucking wall, on -bus this doesnt work
>>
>>101121741
after i started programming my masturbation frequency dropped by more than half, my dick has unironically shrunk a solid inch (serious) because of the loss of elasticity
>>
I'm an engineer not a programmer, but I know some coding. Need to create for myself a tool using AR (not AR-15 but augmenter reality one). It should take a picture from a camera, recognize several QR codes place on the table, establish a virtual plane=table and I should be able to virtually measure the distance between different points on that table. How accurate would be the measurement? How to do code the virtual measurement part? I know you are itching to reply with "something something OpenCV", I already now about it. I already took a pice of code that recognizes QR codes and it works. But that's it, I don't know how to move forward, any help?
>>
>>101122014
>establish a virtual plane=table
?
>>
Is working on replit on the phone a good idea if I’m away from the computer when I want to learn python?
>>
>>101122125
How can I explain it better? It's like those smartphone scanner apps where you take a photo of a standard piece of paper and it gets transformed to the correct rectangular shape and had correct dimensions on your phone that you can export to PDF for example.

I need to do something similar but measure points on that image, since the QR code dimensions are known and can be transformed.
>>
>>101103697
concurrency in modern C++ 2nd ed
you are expected to be at least workably familiar with C++
it's just running multiple tasks at the same time in the same address space and because of caches and speculative execution and other stuff each thread's potentially in a different state and to do some form of synchronization to share data
they're useful when you can break a task down into smaller discrete components like a taskflow graph or if it's something inherently parallel so each thread could work on any part of the task (this latter kind of problem is also good for using SIMD instructions and general purpose GPU computing) a simple example being adding two large arrays
it's very simple at a fundamental level, writable shared state is bad (read-only is generally fine) and the more shared state you've got the slower things get, whether that be via lock contention or atomics locking up the bus
>>
>>101122191
why do you even need help with this? you just scale the qr codes and then compute the scale as the 3rd dimension,y-x through the euclidean formula...
>how do i scale the qr codes?
depends entirely on your hardware (camera) and
https://en.wikipedia.org/wiki/Inverse-square_law
>>
how would you go about backporting chromium to function on a linux 2.6.x kernel
>>
>>101122014
>>101122191
i can't fucking remember the word for this, i was looking into similar things a while back for an AR project that never worked out
depth estimation?
i think opencv is actually one of the least accurate solutions these days, I don't know how often they introduce new shit
iirc facebook's got an ML model that's more accurate which they use internally in their oculus headsets i think
there's also various SLAM implementations, collada's got one, which from what reading I did is unironically what The Missile meme is referring to some of which are fairly recent that might be more accurate

if you've got points on the table in some coordinate space just make them vertices of a quad, you need to multiply them by a transformation matrix (rotation, scale, translation) that i think results in 90 degree angles and preserves the ratios of the distances, the result of that matrix multiplication would be used as something like the input to an image transform or something which takes the quad and the that's your fixed up image and virtual measurement area
virtual measurement is would be vector in that coordinate space and a simple coordinate space transform back to reality
>>
>>101122536
*collabora
not collada
collada's a 3d file format
also iirc SLAM's also meant to also handle things like error correction for sensor drift so it might be the better option
i think they all use the same kind of signal processing techniques under the hood but there are a variety of differing implementations to shop around for
>>
stumbled upon the gdt layout, https://github.com/torvalds/linux/blob/master/arch/x86/kernel/cpu/common.c#L123

>linux doesnt use tss for per-thread state
>only one nested interrupt
this is what a culture of decentralization does.
>noooooo but we need 40 processes running in the background
kek
>>
wrong link baka
https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/segment.h#L91
by the way stumbled means i got it from SO
>>
File: anime_grill.png (128 KB, 256x256)
128 KB
128 KB PNG
Given a DSP process that fetches audio samples periodically from a large memory space: if i have a side-thread prefetch the sample blocks which i'll be reading next cycle during DSP inactivity, can I expect cache hits and speedup?
(or is this a shit idea not worth trying)
>>
I'm storing data representing a terminal screen. Each cell contains a single character. What would be a good data structure for this? It needs fast access and write times. I can't just store an array of chars/codepoints - if you were going to suggest that you should learn 2 unicode.
>>
>>101123310
Array of ints
>>
Anyone that works as a dev, when you code for work in a percentage on a daily basis how many times you use other than python's built-in functions?
>>
how do you know when you need to start refactoring your code? I'm starting to get classes that are about 400 lines long but at work its not uncommon to see classes get to 2000 lines
>>
>>101123714
when it starts feeling like a rickety house of cards
>>
>>101123739
may as well refactor again to separate the logic
>>
>>101123149
no, the tlb gets cleared on any context switch
I might have hallucinated but yesterday i think i read about some option to not invalidate when threads of the same process were consecutive in the queue in linux, wont try to remember it though
>>
File: ebussy_hiker.jpg (58 KB, 600x600)
58 KB
58 KB JPG
>>101123753
refactoring hell is real you know? there is no use-case for elegant code.
>>
>>101123833
I know which is why I question doing it but I'm automating away my job search and sadly the actual application code is getting unweildy simply due to all the edge cases related to HR and their bullshit wording of the same 10 questions more or less
>>
why does every language except java seem like shit
>>
>>101123981
Favorite curry recipe?
>>
If my software needs to work with a decent size amount of data (~1GB) and I want it to be in RAM for performance reasons, and I don't want to write it out to disk until I'm done with but I also want to be resistant to crashes, how could I solve this problem?

some ideas I had were
>make a "ramdisk" and store my data in that. Can you do that programatically? if it's created by a process, can you have it persist after the process crashes? maybe you'd need a thin manager process to keep the ramdisk alive and monitor the real applicaiton instead?
>use 2 processes with shared memory, 1 just holds data and that's it, so if the process that actually does work crashes, the data holding process is still alive doing nothing and you can restart and reconnect to it, or have it dump to disk
>>
>>101125284
On Linux, /tmp is almost always RAM based these days, or you could even use /run.
But honestly the watcher process sounds like a better idea, because you won't accidentally leave a bunch of RAM wasted if you forget to clean up.
If it's about windows, no idea.
>>
>>101101055
gonna attempt to write my first parser
working on the lexer currently

quick question for anybody who knows: where do you draw the line between the lexers job and the parsers job?

for example in the language im writing a parser for (jasmin) there are something called directives which is any symbol followed by a colon (so "test:"). Should i just handle that in the lexer? Generate a "DIRECTIVE" token with the value "test"?

or should i keep it simple and just have a token for a colon and a token for a symbol and handle it in the parser?

Also should my lexemes be generic or specific? i.e.
enum class TokenType
{
Symbol,
Keyword, //exact keyword string is set in the "value"
};

//vs
enum class TokenType
{
Symbol,

//keywords
Public,
Private,
Class,
//etc.
};
>>
>>101125492
It's not that uncommon to have a blurry line between the two. I think for example, C, you'd need to feed symbols from the parser back into the lexer for typedefs or some crap like that. But then Clang used a non-standard syntax similar to your first example so they didn't need to do that.

Basically just do whatever seems right to you in the moment.
>>
>>101125526
ok thank you
>>
>>101125492
>Also should my lexemes be generic or specific?
It will be more useful later on to be specific, you don't want to end up using a switch statement again in the parser just to understand which keyword it's being fed. Attaching a payload to your enums is more useful to store literals and identifiers (like TokenType.FLOAT(2.2) and TokenType.IDENTIFIER("myVar"))
>>
>>101123981
Your brain has been bricked
>>
>>101121970
Works on sub- on my machine.
>>
>>101122476
I would upgrade my kernel because I'm not a luddite
>>
>>101125284
Just mmap the file, preallocate 10GB, mmap it, write data, unmap it, resize it to be amount of data you wrote, if Linux has nothing better to do, or there's not enough memory, it will start writing data out into disk ahead of time and it will be faster and simpler.
If you use fallocate, you won't need to wait for disk to find 10GB.
>>
>>101101055
rsync -rtlHq --delete-after --delay-updates --copy-links --safe-links --max-delete=1000 --delete-excluded"


Can someone tell me what am I doing wrong in my rsync args? I am trying to keep a remote rsync server synced on my machine, it's a bulk data server so it changes every 2 hours. I need to sync it all the time just to have the same data as the server has, that also means to delete files that are not available on the server. In other words I need rsync to act as a 1:1 mirror of the server. Kindanons please help.
>>
>>101126039
you could start by reading the manual instead of throwing random flags in, no idea why anyone would need more than
rsync -av --del

If you needed more, you wouldn't be asking on /g/.
>>
>>101126069
Dumbass, pulling things out of your ass, --del flag will remove data afterwards, invalidating any syncing done. Educate yourself by RTFM.
>>
>>101120955
no, i'm writing it myself.
you sound very bitter.
>>
File: 1711370782843848.png (84 KB, 240x240)
84 KB
84 KB PNG
>glibc got support for <stdbit.h> recently
Nice.
>>
>>101119880
>Hards in green
>Easy in red

Who drew this shit?
>>
>>101126709
>recently
January isn't recent, even my gentoo stable is on
>sys-libs/glibc-2.39-r6
anyway, looking at it, it is useless
>>
File: output.png (741 KB, 1024x768)
741 KB
741 KB PNG
hell yeah jpeg decoding
>>
>>101127662
I can't say I follow libc patchnotes religiously. I just noticed it. I don't recall seeing it there like 3 months ago or whenever I was last 'vim /usr/include/std<tab>'.
>>
>>101127662
>stdc_count_ones
>stdc_has_single_bit
>stdc_bit_width
these seem useful to me, they could replace some bitshifting logic in my current program for expanding channels
>>
>>101127765
first problem I saw in my stdbit.h is that a lot of functions check if value is 0 before calling the builtin which is UB to call with 0, but in all contexts I used those functions, I already check for 0 because masks are useful for searching and things like that and my code needs to know this, so these wrappers are just extra bloat, I already use builtins myself.
>>101127801
just learn how to use compiler builtins, it's not hard to make a few #ifdef checks which are better than generic library doing it generically for you.
>inb4 he trusts libraries
read this page and think again https://stackoverflow.com/questions/2898228/can-isdigit-legitimately-be-locale-dependent-in-c
>>
>>101127828
>Just make your code unportable for no reason
Compilers have things called optimisers, you know? A redundant 0 check isn't going to cause any issues.
>>
>>101101055
rewrite of my weather app - hopefully I can fix some bugs and use some new technologies.
>>
>>101127892
>just rely on an optimizer
no thanks
>#ifdef is unportable
I have AVX2 algorithm and currently am extending my program on machine that only has SSE, ifdef is portable for me, not my problem.
>>
File: zoom.png (1.83 MB, 1782x1050)
1.83 MB
1.83 MB PNG
added zoom mode and an image toolbar to my booru viewer

>>101127692
text rendering looks strange, especially the letter spacing and alpha blending look wrong
>>
>>101128020
Did you write your own UI toolkit for that?
>>
>>101128041
yes
>>
>>101128074
Is there publicly available source for it?
I've been interested in UI stuff lately.
>>
>>101128091
not for now
but i published the source for the cross platform window creation abstraction i made
>>
>>101113384
auto-vectorization barely works anyway.
>>
>>101128142
ironically, g++ shits out quite impressive vectorization for recursive factorial, doesn't with with gcc though.
>>
Maintaining enterprise software written in C++ and Qt makes me want to shoot myself.
>>
>>101128322
>Qt
I am so glad I never had to learn it.
t. C++ dev with almost 20yoe
>>
>>101128322
that's what cargo cultism does to you, it has been a joy for me to try writing C++ with as little standard library as possible, I wrote my own string class and string allocations go into static array that I must be fully aware of and it's still better than std::string.
The program I wrote using it is bottlenecked with raw std::memcpy and std::memcmp calls now and not allocations.
>>
>>101128358
have you tried benchmarking it against std::string with std::pmr::monotonic_buffer_resource?
>>
>>101128389
It's just one extra dereference over just using C, how slow can it be kappa
>>
>>101128354
>>101128358
Eh, it's not that terrible desu, but I question the design decisions taken by the previous developer.
All the logic is encapsulated in various classes, which sounds nice, but the end result is an unmaintainable mess.
>>
>>101128389
Yes I benchmarked my custom find against std::string::find and for some reason it's twice as fast with just SSE2.
I didn't even bother benchmarking allocations, because my code performs 0 of them. Currently, my program has 1MiB buffer preallocated by kernel during process initialization and it performs tasks of downloading bloated ~200KiB pages and parsing them down to ~50KiB text that is then printed to terminal using one write syscall.
It is important to note, that my download code splits buffer in two and OOMs if lower half is overran, while the second half is used for output and performs 0 checks, allocations never fail and therefore are simple inline functions, such as:
    string&
append(char const* const data, std::size_t const size) noexcept
{
std::memcpy(data_ + size_, data, size);
size_ += size;
return *this;
}

string&
append(char const* const beg, char const* const end) noexcept
{
return append(beg, end - beg);
}

string&
append(std::string_view const text) noexcept
{
return append(text.data(), text.size());
}

string&
append(char const character) noexcept
{
data_[size_++] = character;
return *this;
}
>>
>>101128424
that's what I was thinking. just curious whether it was worth it. there's always room for optimization for special cases, but standard library is not bad for general case.
>>101128428
yeah, std::string has famously shitty interface, but it's standard, well-tested, and ready to go. I try not to rewrite stuff unless I have a good reason.
>>101128451
>I didn't even bother benchmarking allocations, because my code performs 0 of them.
well, but std::string does (at least for large enough strings). without benchmarking std::string with the same allocator, the entire benchmark doesn't make much sense.
>>
>>101128488
even with hypothetical perfectly inlined static buffer, std::string performs capacity checks and also has small string optimization meme overhead which makes it slower than ANY custom solution.
>>
>>101126709
>less inline assembly
always a welcome change.
>>
>>101128570
if you use asm when builtins exist you're probably very dimwitted
>>
File: 1.jpg (23 KB, 444x260)
23 KB
23 KB JPG
sir did you ever encounter a calculation that performed poorly in a modern pc, using common languages?

my experience:
>rotating and shifting images with opencv would take 20 min for 10k images
>faking db tables with million rows would take hours

m trying to learn cpp and optimization so im looking for examples that will show poor performance so i can try optimizing
>>
>>101128645
read my post again because i literally was not disagreeing with you
>>
File: 1713475225831229.png (211 KB, 502x447)
211 KB
211 KB PNG
>>101128020
>text rendering looks strange, especially the letter spacing and alpha blending look wrong
yeah that's from converting greyscale->rgba without correcting for alpha, so the alpha pixels of each glyph become darker in rgb, your text rendering looks much better anon! oh and the spacing is from
x += glyph.w
like a bitmap font, but that's easy to fix
>>
>>101128754
you cant optimize the things that you have no control over
>>
>>101128797
>find example problem that performs poorly in python/java/js
>try writing a solution for that problem in cpp
>compare

thats my idea
>>
>>101128768
you replied to a post that is happy about stdbit.h which is a thin wrapper around builtins, these builtins already existed for how long?
>>101128754
--------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------
BM_fnv_normal 21.4 ns 21.3 ns 32800643
BM_fnv_fast 47.5 ns 47.2 ns 14834743

optimization on old CPU's takes twice as long on modern ones, if you want to see the code just go read official FNV hash algorithm dev page: http://www.isthe.com/chongo/tech/comp/fnv/
>>
Anyone know why I need to drop a column after performing one-hot encoding on the categorical values of a dataset?
>>
>>101129265
Isn't that an ML question?
>>
>>101129315
Yeah why?
>>
>>101129350
Because there could be a theoretical reason for dropping a column like degrees of freedom, or there could the technical reason like off-by-one error. Your question is just garbage so I thought I would give a little bit a humiliation ritual to get you accustomed to asking shitty questions.
>>
>>101129370
I have no fucking idea, I'm just starting out, I understand that OHC is useful for converting categorical data into binary vectors but I don't understand why everyone recommends to drop a column (usually the first one) after applying OHC.
>>
>>101129397
because all zeros is a valid vector that is different than all of the other categories, so you have an extra degree of freedom you need to get rid of
>>
>>101129463
Sorry I guess I'm a literal retard, but how does removing a single column ensure that you don't have all zeros anyway? Assuming you're decomposing a categorical variable that can take say, 4 different values, your columns will look something like [0, 0, 0, 1], [0, 0, 1, 0], and so on. I don't see what removing the first zero changes.
>>
>>101129499
You do misunderstand. You remove one column and then the zero vector takes it's place.
>>
>>101129511
category A: [1, 0, 0]
category B: [0, 1, 0]
category C: [0, 0, 1]
becomes
category A: [1, 0]
category B: [0, 1]
category C: [0, 0]
>>
>>101129511
>>101129540
Yeah I guess I need to work with it more and it'll click.
>>
The code I wrote that was good has turned out to be garbage.
>>
>>101129584
just make it good again
>>
File: 1704071252660661.png (889 KB, 1050x903)
889 KB
889 KB PNG
>>101129584
>try pthreads to decrease startup time
>startup time goes from 600ms to 900ms
>>
>>101129622
>600ms
>good
>>
>>101129622
how did you hallucinate that starting extra threads won't increase startup time?
>>
File: 1704061755219926.jpg (22 KB, 311x358)
22 KB
22 KB JPG
>>101129638
yeah, i was trying to decrease it

>>101129646
i didn't know the overhead would be so high
>>
>>101129638
he must be using python, I have a python script that takes 0.6s to print --help, rewrote it in C++, now startup is dominated by curl_global_init while --help takes 3ms max
>>
>>101129622
how many threads?
>>
>>101129672
if you care about startup you will not
>run more than one thread
>use libraries
>use language with worse compiler than C++
>>
>>101129686
this is also sepples, just on a very slow sbc

>>101129697
2, one for each part of initialization that share no state
>>
>>101104034
I'm currently in the second path, CS grad with no job and nobody wants me, so I just do cool projects in C and contribute to other open source projects that use C.
>>
>>101130035
I dropped out because I realized that I will be just like you.
>>
>>101129711
>2
I don't know what you're doing in those threads, but spawning 2 threads alone shouldn't have any noticeable overhead.
>>
>>101129584
are you me?
>>
>>101130465
>>101130465
>>101130465
>>
>>101129622
the linux interface is bloated so they need to allocate like 1 gigabyte of memory in kenrel structures for every running thread

>>101129672
>decrease startup time? yeah a syscall will do it
kek
>>
b
>>
>>101134189
oh
>>
>>101101055
Couple of ballers in this photo



[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.