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


File: IMG_20240719_231732_801.jpg (76 KB, 1061x718)
76 KB
76 KB JPG
What Windows programs are you working on /g/?
>>
>>101498438
waiting on hardware to arrive to get to work on software that automatically pulls PCI config so I can streamline making emulated drivers for masking FPGA boards
>>
File: reallocs.png (28 KB, 1894x989)
28 KB
28 KB PNG
Windows? Guess I'll have to sit that one out ... I'm busy with other things right now.
>>
Erlang
>>
Is tkinter /comfy/?

Every other toolkit is turning to shit.
>>
>>101498438
The OP is not your personal shitposting space.
>>
>>101498472
so you are doing SMI shit? processor???
>>
>>101498525
A-huh.
>>
threads go from 270 to 330 so fast and then its a ghost-town
>>
>>101498669
arguing with narcissists is exhausting and moving to a new thread is a clean break prompting people to stop doing it and do something else but they have no energy left to do anything good
>>
>>101498722
I thought the delusional ones are narcissists?
>>
>>101498753
he who looks around and sees only assholes..
>>
>>101498502
>Is tkinter /comfy/?
I've written some of it, so I think so.
>>
>>101498772
This is 4chan.
>>
>>101498722
>>101498772
projecting much?
Do you happen to write python and dislike Unix?
>>
>>101498828
And your usual spot is R30dit.
>>
File: 12.png (71 KB, 392x458)
71 KB
71 KB PNG
>>101498850
Nah, I was banned from there for making fun of colorblinds.
>>
>>101498873
>making fun of colorblinds
Do you just hate men? Is that the problem?
>>
File: 02.png (39 KB, 700x297)
39 KB
39 KB PNG
>>101498980
Don't be ridiculous. I hate all human beings equally.
>>
tritanopia filter with normal eyes makes things look so cool.
>tfw blue leaves
HMMMMMM
>>
File: 104.jpg (858 KB, 1512x2016)
858 KB
858 KB JPG
>>101499233
>>
>>101498999
It says I'm green blind. It's fake, right?
>>
>>101499303
anon...
it even says that "if you cant read this you are gay"
owari desu
>>
File: fruits.jpg (102 KB, 1024x691)
102 KB
102 KB JPG
>>101499303
>he doesn't see the "your green vision is correct" line
I've got bad news for you ...
>>
File: 2024-07-21 01.39.33.png (226 KB, 1146x1018)
226 KB
226 KB PNG
>>101498438
fuck Windows, I compile everything to WASM now. It will work forever!
>>
File: nogreen.jpg (261 KB, 700x297)
261 KB
261 KB JPG
>>101499337
>>101499355
It's over.
>>
File: part2.jpg (665 KB, 1080x5435)
665 KB
665 KB JPG
>>101499398
You take it much better than others I've seen.
>>
>>101499393
hello washington hernandez
>>
>>101499442
how do you go through life for 20, 30 years without noticing that you're colorblind?
>>
File: dew9u43zcb891.png (592 KB, 1446x1809)
592 KB
592 KB PNG
>>101499612
Red- and green-blindness is something you're born with, and since it's the only reality you know you don't question it. A lot of states don't have mandatory screening in schools, and a lot of people still believe that "they've just never learned their colors" or some junk, that the reason why others are able to tell the difference between green and yellow isn't because they pay more attention, but that they appear to trichromats as distinct as yellow and blue.
>>
File: Capture.png (87 KB, 1790x743)
87 KB
87 KB PNG
what kind of UB is this?
https://godbolt.org/z/5Y6rh5qn1
>>
>>101499303
green bligger.
>>
>>101499879
>doesn't return a value in a function that's supposed to return one
>why do I get UB
one of the great mysteries of programming
>>
>>101499898
read your K&R sweaty you're just a baby
>>
>>101498537
nothing specific with either the boards/chips or the software that uses them. *just* the firmware/tpl emu/etc

the hobby focus is DMA cheating (2pc) in online games (i simply don't agree with the current anti-consumer practices and would prefer to shit things up in my old age)
>>
>>101498438
Hey anons, hoping to seek some resources and advice on how to move forward. I'm currently trying to self study Distributed System from MIT, but I'm getting filtered.
I got to the point to understand that to implement consensus algorithm, like Raft, I have to overwrite large part of the design of the paper. I did try reading other people/open-source design of Raft, which seems to be using state machine(s).
At this point, I'm just confuse on how they even arrive at designing their solution in the first place. Is there something I should consider reviewing/study or do you have any resources on practicing design/implementation before doing raft implementation? Thank you in advance.
>>
>>101500144
based, be wary though
>>101496481
>>
>>101500230
which is exactly what im not messing with the software side

middle man excuse
>>
podlife.neocities.org
>>
>>101500315
You are getting slow
>>
>>101500315
>ipgrabber
>>
>>101499954
>K&R
obsolete
>>
>>101499898
nvm I misread the output lmao
>>
>>101436298
tried to improve on it by using a hashtable did i do well

 public class MostCommonWordsHash 
{
public static void main( String[] args )
{
//Print the N most common strings in a given list of strings.
List<String> list = Arrays.asList("apple", "orange", "banana", "pear", "apple", "orange",
"banana", "apple", "orange", "apple");

printMostCommonWords(list, 3);
}

static void printMostCommonWords (List<String> list, int limit) {

HashMap<String, Integer> hashMap = new HashMap<>();
for (String string : list){
hashMap.put(string, hashMap.getOrDefault(string, 0) + 1);
}

ArrayList<Word> wordList = new ArrayList<>();
for(String string : hashMap.keySet()){
Word word = new Word();
word.setString(string);
word.setQuantity(hashMap.get(string));
wordList.add(word);
}

Collections.sort(wordList);

int wordsPrinted = 0;
for (Word word : wordList){
System.out.println(word.getString() + ": " + word.getQuantity());
wordsPrinted ++;
if (wordsPrinted == limit){
break;
}
}
}


};

class Word implements Comparable<Word> {
String string;
Integer quantity;


String getString(){
return string;
}

public void setString(String string) {
this.string = string;
}

public Integer getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}

void raiseQuantity(){
quantity ++;
}

@Override
public int compareTo(Word other) {
return -Integer.compare(this.quantity, other.getQuantity());

}

}
>>
>>101501076
>String getString(){
> return string;
> }
> public void setString(String string) {
> this.string = string;
> }
> public Integer getQuantity() {
> return quantity;
> }
> public void setQuantity(int quantity) {
> this.quantity = quantity;
> }
> void raiseQuantity(){
> quantity ++;
> }
good morning sir
>>
>>101501076
LGTM, sar
>>
>>101501076
heres how to do it in haskell btw, using the &&& operator
mostCommon list = fst . maximumBy (compare `on` snd) $ elemCount
where elemCount = map (head &&& length) . group . sort $ list
>>
>>101501076
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class Main
{
public static void main(String[] args) {
List<String> list = Arrays.asList("apple", "orange", "banana", "pear", "apple", "orange",
"banana", "apple", "orange", "apple");
printMostCommonWords(list, 3);
}

static void printMostCommonWords(List<String> list, int top) {
HashMap<String, Integer> hashMap = new HashMap();
for (String string : list) hashMap.put(string, hashMap.getOrDefault(string, 0) + 1);
hashMap.entrySet().stream().sorted((e1, e2) -> -e1.getValue().compareTo(e2.getValue())).limit(top).forEachOrdered(System.out::println);
}
}

It's just 3 lines, sar, Vishnu bless.
>>
File: rusttracing.png (890 KB, 800x800)
890 KB
890 KB PNG
>>101488490
I fucked up somewhere. My super parallelized rust version fully using 12 cores took a day to render. I thought that was strange because the code in the book is only single threaded. Is the author expecting everyone to wait a week before they can enjoy the final render? So I downloaded the c++ version and run it on my laptop and it only took a couple of hours to render on a single core. Now I have to figure out where it all went wrong in my code or if rusties lied to me and c++ is just that much superior.
>>
>>101500601
>obsolete
more relevant than C23 lmao
>>
>server supports 1000 clients
>server has resources to do 100 "big operation" at a time
>all clients make a "big operation" request at roughly the same time
how is something like this normally handled in terms of the execution of "big operation", do you do it in threads, or is there a point where creating too many threads is worse (say 100 000 clients and resources for 10 000 "big operation"? or maybe it just depends on what the operation is, some you have to thread and others you could combine into a mega operation with a in/out queue?
>>
>>101502385
Having SIGNIFICANTLY more threads than the number of CPU cores you have is rarely a good solution, at least if we're talking about real OS threads and not some kind of green thread.
I'd just use a queue.
>>
when I rebase in git I sometimes do it on a copy of my branch if I think there will be wide reaching conflicts. once I'm done I want to 'fast forward' the original to this conflict resolved copy.
If I merge the rebased version I get conflicts
If I rebase the rebased version I get conflicts

What am I supposed to do? Because they had identical history I thought it would just werk TM but it doesn't
>>
>>101502385
It depends on many factors.
More kernel threads than cores is bad.
Spamming virtual threads for CPU bound tasks is bad.
You want a queue so you can respond to the client to come back later instead of wasting resources, both you and him, waiting.
>>
>>101501873
The hormone therapy can continue, I found the problem! I didn't create the bounding volume hierarchy probably. With that fixed the rust version is only twice as slow and since I don't really know what I'm doing I find that acceptable for now.
>>
>>101503189
How many malloc/free calls do you have?
>>
>>101503199
All the Boxes and Rcs should only be created during the initial scene setup if I didn't fuck up. Would have to use a profiler to see what's going wrong.
>>
>>101499442
why are these discord trannies overreacting
>>
File: part1.jpg (1.21 MB, 1080x5319)
1.21 MB
1.21 MB JPG
>>101503275
Lack of shame.
>>
>>101502385
You make the server submit a task to a queue, create as many worker threads as reasonable, then get back to the clients when their work is done. Alternatively, you just tell them the server is busy and this action cannot be performed at the time.
>>
>>101503299
BRO IM LIKE
IM LIKE POSTING SOME MUNDANE SHIT
BUT ITS IN ALL CAPS
AND IM A TRANNY
PLEASE REACT HARDER
>>
>>101503307
And?
>>
>>101503275
growing up w/ 0 friends
>>
File: my-texture-being-drawn.png (104 KB, 504x502)
104 KB
104 KB PNG
Does OpenGL (ES) really not have a way to have your textures be flipped at upload time, even as a (widely supported) extension?
What shit were they huffing in the 90s to have the UV coordinates origin in the bottom left?

It could have been so elegant, but now I have to use the row-by-row reading function and put that shit in upside-down.
glGenBuffers(1, &ctxt.upload_buf);
glGenTextures(1, &ctxt.texture);

glBindBuffer(GL_PIXEL_UNPACK_BUFFER_NV, ctxt.upload_buf);
glBufferData(GL_PIXEL_UNPACK_BUFFER_NV, dec_size, nullptr, GL_STATIC_DRAW);

void *ptr = glMapBufferRangeEXT(GL_PIXEL_UNPACK_BUFFER_NV, 0, dec_size,
GL_MAP_WRITE_BIT_EXT | GL_MAP_INVALIDATE_BUFFER_BIT_EXT);

spng_decode_image(spng_ctx, ptr, dec_size, SPNG_FMT_RGBA8, SPNG_DECODE_GAMMA);
spng_ctx_free(spng_ctx);

glUnmapBufferOES(GL_PIXEL_UNPACK_BUFFER_NV);

glBindTexture(GL_TEXTURE_2D, ctxt.texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ihdr.width, ihdr.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);

glBindTexture(GL_TEXTURE_2D, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_NV, 0);
>>
>>101503516
i mean it should but i don't remember
swapping vector coordinates on copy is trivial
just use a compute shader assuming they even capable of anything in opengl
i know there were a fair few problems with them which made them unsuitable for real compute pre-vulkan but i think blitting images should still be a valid usecase
>>
>>101503548
I'm targeting a version of OpenGL ES that doesn't even have compute shaders, but this would be doable as a render to texture. That's really a lot of extra hoops to jump through to use data that the GPU should already support natively.
It's not like I have to worry about this when I upload stuff in Vulkan.
>>
>>101499879
>warning: Implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296
So I guess in unoptimized build the value changes due to IEEE 754 shenanigans, and in optimized build the original value is loaded into register and printed directly.
>>
>>101503516
>What shit were they huffing in the 90s to have the UV coordinates origin in the bottom left?
Old GL always had a texture matrix so you could just do the transformation via that matrix.
>>
what's the difference between boost::any and boost::unique_any? boost doc says:
>Think of boost::anys::unique_any as of an alternative to boost::any (or to std::any) that does not require copy or move construction from the held type.
if boost::unique_any is less constrained, why would I ever choose other ::any variants?
>>
File: my-texture-being-drawn.png (104 KB, 502x508)
104 KB
104 KB PNG
>>101503516
Fortunately this library has a nice API (libspng), so reading line-by-line isn't too much of a mess.
I hope when I add support for other formats, those APIs have a nice API for it too.

Also, check out this sick pointer-to-VLA code that sepplesfags wish they could do.
uint32_t (*rows)[ihdr.width] = glMapBufferRangeEXT(GL_PIXEL_UNPACK_BUFFER_NV, 0, dec_size,
GL_MAP_WRITE_BIT_EXT | GL_MAP_INVALIDATE_BUFFER_BIT_EXT);
int err = 0;

spng_decode_image(spng_ctx, nullptr, 0, SPNG_FMT_RGBA8, SPNG_DECODE_GAMMA | SPNG_DECODE_PROGRESSIVE);
for (uint32_t i = ihdr.height; i-- > 0 && err == 0;) {
err = spng_decode_row(spng_ctx, rows[i], ihdr.width * 4);
}

if (err != SPNG_EOI)
return 1;

spng_ctx_free(spng_ctx);
>>
>>101503780
it's probably something like lambda based type erasure like std::format vs inheritance based dynamic dispatch which always requires copy and move

counter question, why would you ever use boost?
granted they've made some fucking huge strides in unfucking their shit, the bext non-boost variants of their newer libraies are actually worth using
99% of boost is bloat and pulling in 1% of boost still pulls in 99% of boost and most of that bloat is worthless trash to support completely irrelevant compilers
>>
>>101503847
oh no never mind it's still dynamic dispatch they're just not even attempting to support copy or move construction
mildly concerning it's using boost's type_index, i can't remember if that's dependent on RTTI but most custom any types intentionally avoid any and all RTTI dependent infrastructure
i quite like llvm's ADT/Support implementation of any which only depends on llvm demangle
>>
>>101503847
>counter question, why would you ever use boost?
I just consider it an extension to stdlib, and include it if I need anything in there. it has some cool things like bi-directional maps, r-trees, function traits, more specialized smart pointers, asio, etc. it's bloat, but nothing insane by today's standards. also most of it is header-only so whatever.
>>
>>101503893
yeah, because of those, and the fact it doesn't seem to support custom allocators, I think I will roll my own at some point. shame. for now I will continue using it.
>>
not sure if making this look like a fisher price toy from 2002 impeoves readability or not
>>
why is it so hard to get started for OS dev?
am i better off reading xv6 source code and try to reverse engineer it to start my own OS? i want a simple tutorial that tells how to boot my os and write something on the screen, after that i can go on by myself.
>>
>>101505383
lot of information gets thrown at you by incompetents and you need to account for various quirks (which might take your focus away from important things for a while).
Anyway, read the osdev .org forums
>write something to the screen
write a driver for a video card
>>
>>101505499
>lot of information gets thrown at you by incompetents and you need to account for various quirks (which might take your focus away from important things for a while).
i tried so many tutorials and none of them helped me write a fucking hello world inside qemu
>>
>>101505673
>emulate bios
>int 15, whatever was the number for writing to the console in a
>pass it the string "hello world" in c or whatever the calling convention is
i have never done bios because i am young but it should be that easy.
>>
pointer usage in uefi is so fucking weird bros
>>
>>101506214
?
>>
>>101506282
>IN OUT mapkey
>but its actually a pointer
>ok that makes sense because it is returning through memory
....
>loadimage
>IN OUT sourcesize

and i just realized that it is only IN
it was a dumb post
>>
>>101501076
initialize string and quantity through a constructor, drop the setters for both
make string final
>>
>>101498438
>damn these function calls look awful they should really be macros/functions
>damn these...
>damn...
>repeat for a couple of weeks
>forward to now
>damn this stuff is looking awful
>string of function calls is repeated 4 times with extractions from a configuration file

something needs to change.

Clean your code up Anon.
>>
>>101507014
I tried using a constructor at first but it wanst compiling, i don't know why. no hate please

 public class MostCommonWordsHash 
{
public static void main( String[] args ) throws Exception
{
//Print the N most common strings in a given list of strings.
List<String> list = Arrays.asList("apple", "orange", "banana", "pear", "apple", "orange",
"banana", "apple", "orange", "apple");



printMostCommonWords(list, 3);
}

static void printMostCommonWords (List<String> list, int limit) throws Exception{

HashMap<String, Integer> hashMap = new HashMap<>();
for (String string : list){
hashMap.put(string, hashMap.getOrDefault(string, 0) + 1);
}

ArrayList<Word> wordList = new ArrayList<>();
for(String word : hashMap.keySet()){

wordList.add(new Word(word, hashMap.get(word)));
}

Collections.sort(wordList);

int wordsPrinted = 0;
for (Word word : wordList){
System.out.println(word.getString() + ": " + word.getQuantity());
wordsPrinted += 1;
if (wordsPrinted == limit){
break;
}
}
}


};

class Word implements Comparable<Word> {
String string;
Integer quantity;

public Word(String string, int quantity) {
this.string = string;
this.quantity = quantity;
}

String getString(){
return string;
}

public void setString(String string) {
this.string = string;
}

public Integer getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}

void raiseQuantity(){
quantity += 1;
}

@Override
public int compareTo(Word other) {
return -Integer.compare(this.quantity, other.getQuantity());

}

}
>>
Is there a better alternative to Cursor (the AI programming text editor) that also runs on Linux? Something that's gratis or free.
>>
File: fat_states.png (569 KB, 5000x3500)
569 KB
569 KB PNG
>>101498438
hey guys im an absolute retard when it comes to command line stuff. can anyone help me use my dwebp? (command not found). i have it on my desktop and i see it listed dwebp.sh but can't seem to call it. what am i doing wrong?
>>
>>101508101
sh ./dwebp.sh
>>
>>101508101
>>>/g/sqt

>i have it on my desktop
how about clicking it?
how about right clicking it to see the full path and copy pasting into the shell?
they usually default to some operating system dependant directory (eg. /usr/bin)
>>
File: 1720303071076370.png (14 KB, 418x363)
14 KB
14 KB PNG
toylang progress, added string templates and print operation ($) with optional labelling ($:tag). you can slap it before an expression quicker than a print statement so I feel like it lends itself better to print debugging (which I'm going to have to rely on until I write a debugger ie. never)
>>
I'm building abstractions, on top of my abstractions.
>>
>>101503307
No future, no salvation. Yikes.
>>
Why C++ QT when C++ WinUI exists?
>>
>>101508997
>windows
lol
>>
Is it worth it to stick to Python in 2024?

I kinda want to use a "better" language. I hear a lot of stuff about Rust, Go, and other languages. I actually would love to focus on C++, but at the same time I feel like I should stick to Python as it feels the easiest (I'm kind of retarded).

My main goal, at this point, is my first job. I am fucking desperate
>>
File: wallhaven-v92z5p.jpg (2.43 MB, 1920x1600)
2.43 MB
2.43 MB JPG
>>101509051
But ui development for linux is a subpar experience, XamlUI and SwiftUI are the only remaining competitors for JS and React
>>
>>101509065
>My main goal, at this point, is my first job. I am fucking desperate
Search the job listing and see the programming language in demand
>>
>>101504539
Looks cool.
>>
>>101507903
after giving it more a than 10 second think, you could just completely drop the Word class; if you want some OOP in it, you could put the "business logic" into an object instead:
public class MostCommonWords {

public static void main(String[] args) throws Exception {
List<String> list = Arrays.asList("apple", "orange", "banana", "pear", "apple", "orange", "banana", "apple", "orange", "apple");

new MostCommonWords(list).sort().print(3);
}

private HashMap<String, Integer> wordCounts;

MostCommonWords(List<String> list) {
wordCounts = new HashMap<>();
for (String string : list) {
wordCounts.put(string, wordCounts.getOrDefault(string, 0) + 1);
}
}

MostCommonWords sort() {
wordCounts = wordCounts.entrySet().stream()
.sorted((o1, o2) -> Integer.compare(o2.getValue(), o1.getValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new));
return this;
}

void print(int limit) {
int wordsPrinted = 0;
for (Entry<String, Integer> word : wordCounts.entrySet()) {
System.out.println(word.getKey() + ": " + word.getValue());
wordsPrinted += 1;
if (wordsPrinted == limit) {
break;
}
}
}

};


As a beginner you should note that you can call methods and refer to fields not only from variable symbols of a given type, but on any expression that returns an object of a given type, i.e. constructors and methods.
"new MostCommonWords(list)" returns a MostCommonWords object, so you can call its methods directly. Here, "sort()" also returns a MostCommonWords object, so you also can call that type's methods.

Another good practice is to keep each action/behavior in a separate method, that way you can pass parameters only to the behaviors that use them, e.g. "limit" is used only for printing, so there's no need for it to be in the scope of other methods or the whole object.
>>
Will bsd protect me from the satanic furries known as the nsa
>>
>>101509423
No, only thermonuclear devices with dead-man switches will.
>>
Are recursion schemes a meme or actually interesting to know?
>>
>>101509562
If you can't think of a use case for a zygohistoprepromorphism on the spot you will never be taken seriously as a Haskell programmer
>>
>>101509613
Maybe, but luckily no one takes Haskell programmers seriously in the first place.
>>
>>101509664
that's because none of them have ever come up with a use case for zygohistoprepromorphisms
>>
>>101509672
Luckily that doesn't sound like a me-problem.
>>
>>101498502
yep
>>
>>101504539
if syntax highlighting with much clearer visual clues (which is what left is) doesn't help readability, that may be an admission that normal syntax highlighting is not much help, either. anyway, i think visual programming is a dead end if you're stuck using keywords.
>>
>>101498438
I might have a try at designing and implementing a retro/reactionary gui library after releasing my current project. I've been noting down some ideas and am somewhat confident it will turn out great.
>>
when you're in an IDE and you're getting a squiggly line because the IDE knows that the compiler won't do it, what is that called? How does gdb relate to this?
>>
>>101510362
my guess is the compiler as an optimisation omits unused code and that the debugger knows that the code doesn't correspond to anything
>>
>>101509696
non meme answer is that its useful to know what folds/unfolds and f algebras is just part of general abstract category bs that sort of becomes clearer and more useful the more you fit in your head
>>
>>101510362
LSP
>How does gdb relate to this
it doesn't
>>
low iq:
if (x) { A } else { B }

mid iq:
if (x) { A return; } B

high iq:
if (x) { A } else { B }


provided A and B are similar in number of statements and neither is an obvious unhappy path
>>
>>101511116
genius:
 if (x){ A; return;} B; 


because it just works.
>>
>>101498438
Tryna get a Linux C++ project to compile on Windows and it's breaking me.
>>
why is there no cand / canlib? is something about can not simple enough to have a universal library
>>
File: 1721537157617934.png (8 KB, 558x423)
8 KB
8 KB PNG
How do I make C# project that reads csv file makes shit ton of complex transformations on huge data and writes end result in new csv file?
>>
>>101511989
You have to do three things, basically.
First you read the csv.
Then you make a shit ton of complex transformations.
And finally, you write a new csv file.
Hope this helps.
>>
>>101511116
That's completely ignoring the fact that you often have those kinds of statements chained together.
>>
File: 1721441132232127.jpg (41 KB, 498x421)
41 KB
41 KB JPG
>>101511989
>tfw can't draw chunky girls like that
>>
When did it all go do wrong?

I am not trying to shill tkinter or python just trying to emphasize the fact that the Gnome devs are actively destroying gtk in every way possible.
>>
>>101512349
>When did it all go do wrong?
From the very beginning, when no one understood not to use malloc/free internally. That's a surefire way to determine whether or not the people in charge have any clue at all what the hell they're doing.
>>
>>101511116
interface Do {
do();
}
class DoA implements Do {
do() { A };
}
class DoB implements Do {
do() { B };
}
class DoFactory {
static getDo(x) {

}
}

// ...

DoFactory.getDo(x).do();
>>
>>101512349
pretty sure you can just remove that whole active function and then it would be equivalent to then python one.
>>
>>101512430
>not church encoded bools
ngmi
>>
>>101512433
I am not sure how to with gtk4 but I doubt that extra function call is slowing down the initialization by 33%.
>>
Python is easy but not simple.
C is simple but not easy.
>>
>>101501214
in python, this is just
most_common = lambda xs: [x for x x, _ in Counter(xs).most_common()]
>>
>>101512349
use case for a gui?
>>
>>101512430
cheers, bob

>>101512349
advocating tk is a very natural thing to do
>>
Got filtered by Jens Gustedt's Modern C. Switching to KN King's C book.
Learning C from the beginning because I used chatgpt to do my assignments, and now I'm a dum fuck.
>>
>>101501214
mostCommon = fst . maximumBy (comparing snd) . M.toList . M.fromListWith (+) . map (,1)
>>
File: 1701660707101336.gif (2.12 MB, 320x320)
2.12 MB
2.12 MB GIF
Apart from the syntax, are there any other differences between the following, in C#?
public interface IFoo<T> where T : Bar { }

public interface IFoo<Bar> { }
>>
do programmers use perfume to go to work?
>>
>>101512349
Does that shit have native Wayland support yet?
>>
>>101514500
I work from home so yes.
>>
>>101514500
cheeky bit of black afgano
>>
File: coral_sea.png (496 KB, 1024x629)
496 KB
496 KB PNG
>>101508127
thanks. this gave me an error but at least it got me started. i can figure it out from here.

>>101508136
i only know how to call it from terminal. i've used it from the desktop before but i can't remember what command i used. i usually save a few webp's in a webp folder then something like /webp/file.webp -o /webp/file.png according to the readme. yes i know it's a stupid question i knew you guys would help me faster though.
>>
>>101514007
Are they not completely different? One is saying that T has to be a Bar and the other is saying that Bar is a generic type name.
>>
>>101503275
It’s not that unusual for a person to flip their shit over discovering that they’re colorblind. My Anatomy & Physiology professor said she once had a student FREAK the fuck out during a lecture while they were explaining R/G colorblindness. I imagine it’s a pretty scary revelation for many people to suddenly discover that they’re *blind* in a sense.
>>
>>101514654
God damnit, of course... Thanks.
>>
File: laugh.jpg (30 KB, 474x464)
30 KB
30 KB JPG
>>101499442
>go be straight since your ass can't even see the rainbow
>>
>>101503275
they are probably making it up to begin with just like their gender
>>
File: rings_green.png (132 KB, 600x600)
132 KB
132 KB PNG
>>101516449
Considering that red/green colorblindness is a recessive trait caused by a faulty female X chromosome (meaning that biological females, who got X chromosomes, can compensate for the faulty one with the other, proper one), making it a predominantly male condition (8% of the male population are affected vs. 0.5% of the female one), why would they make up something that constantly reminds them and others that they're actually male? Genetics don't lie.
>>
>>101498438
Added ternary and list generators to Go, sort of. Just pass it to the script and you'll get valid Go code.
package main

import "fmt"

func main() {
eq<string> = 5 + 5 == 10 ? "Equals" : "Unequal"
array = [i+1 for i in range(10)<int>]
fmt.Println(eq, array)
}
>>
>>101513614
Just learn go unless you want to work in low level
>>
>>101513614
Just stop falling for larp nocoders who never wrote any useful program and learn C++. It's really easy and same retards who tell you that it's "complex" are just whataboutist trannies who don't comprehend that God gave humans a brain so they can ignore unimportant things and focus on the essential.
C++ is literally objectively best programming language there is if you can filter irrelevant things. There will never be a better one.
>NOOOO NOT THE OOP
so don't use it
>NOOOOO, THE OVERHEAD from destroying moved-from objects
so don't move anything
>NOOOOOOOOOOOOO, NOT THE EXCEPTIONS
ok so don't throw an exception for something that's a boolean check
>>
>>101501076
in js it's just
["apple", "orange", "banana", "pear", "apple", "orange", "banana", "apple", "orange", "apple"].reduce((a, x) => a.set(x, a.has(x) ? a.get(x) + 1 : 1), new Map()).entries().sort((p1, p2) => p1[0] > pair2[0]).forEach(p => console.log(`${p[0]}:${p[1]}`)
>>
>>101517905
["apple", "orange", "banana", "pear", "apple", "orange", "banana", "apple", "orange", "apple"]
.reduce((a, x) =>
a.set(x, a.has(x) ? a.get(x) + 1 : 1),
new Map()
)
.entries()
.sort((p1, p2) => p1[0] > pair2[0])
.forEach(p => console.log(`${p[0]}:${p[1]}`)
>>
>>101517680
Oh, the retard is posting again.
Oh well.
>>
@101517931
/dpt/ isn't for your personal biographies
>>
You sound powerless to stop me.
>>
File: clojurescratch quine.jpg (506 KB, 1050x1775)
506 KB
506 KB JPG
>>101504539
after looking at more deeply nested code I have to say yeah, it does make it easier to read. But only if it's laid out in a way that makes sense, which is not trivial to do.

>>101509920
>normal syntax highlighting is not much help
Are you the colorblind guy?

>visual programming
what I actually want to achieve is to make an extremely efficient (in terms of how many keystrokes you need to accomplish something) structural editor for S-Expressions and similar nested data structures (JSON is another candidate), an evolution of paredit, parinfer and so on.

It just so happens that along the way I saw a chance to visually represent Lisp/Clojure code in a more easily digestible way than paren soup, which is a nice bonus.
>>
File: 1697818507111734.jpg (48 KB, 680x633)
48 KB
48 KB JPG
I want to check out android development shit, is AndroidStudio still what everyone uses?
>>
>>101518279
isn't all mobile shit done with electron these days?
>>
>>101518279
yes, i think so
though you can get a lot done in termux which is just sandboxed linux (with a few ways to write GUIs)
not quite a replacement for full application development but if i'm trying to test APIs and it's one of the API sets which termux imports i'll write a basic CLI there
>>
File: 1695056971919531.jpg (77 KB, 622x494)
77 KB
77 KB JPG
>>101518615
>Electron: Build cross-platform desktop apps with JavaScript
Do webshitters really?
>>
I think the user meant to say "now" instead of "not"? At least I hope so lmao
>>
Who's your favorite programmer?
>>
>>101519594
Torvalds fifteen years ago.
>>
>>101519594
Carmack
>>
>>101519594
me
>>
How do you guys get minidumps from your steam games? On vacation now so can't really investigate too much, but as far as I can tell, steam only supports dealing with 32-bit minidumps for you. That's obviously severely outdated so I'm assuming nobody is actually using that feature at this point. So what are people doing instead? Is it because unreal/unity manages minidumps as well? (I don't know, never used any of those engines)
>>
>>101519594
aaron hsu
>>
>>101512349
tkinter is absolute garbage and royal waste of time to learn when you want to make anything more complex than clicking buttons or filling text boxes
>>
>>101498438
I remember a discussion about cross compiling from a couple of days ago, someone mentioned that kernels get compiled with some -only-genera_purposeregs flag to avoid calls to XSAVE or something
it is actually done because:
>If the TS flag is set and the EM flag (bit 2 of CR0) is clear, a device-not-available exception (#NM) is
raised prior to the execution of any x87 FPU/MMX/SSE/SSE2/SSE3/SSSE3/SSE4 instruction; with the
exception of PAUSE, PREFETCHh, SFENCE, LFENCE, MFENCE, MOVNTI, CLFLUSH, CRC32, and POPCNT.

idk i thought it was interesting
>>
>>101519594
This guy >>101519881
>>
>>101520411
you're going to have to show comparisons where something was hard in tk but easy in whatever webshit you have in mind
>>
>>101520534
>you're going to have to show comparisons
I am shit at coding all I can say I tried webshit one time and it was infinitely easier like restricting certain text boxes to all capitals or to certain number of characters and automatically transferring rest to another. It was also complete misery when I had to display some data from csv with auto generated dropdowns placed right above columns.
>>
>>101520693
>why yes, i am a clueless webshitter
>now please take my advice and don't use tk
it's all so tiresome
>>
Between OpenSSL, LibreSSL, and GNUTLS, which is more pleasant to work with as a developer? Speed isn't very important to me as it's just a toy project
>>
>>101514709
a more normal reaction would be to reject the colorblindness psyop and carry on with life as usual while seething about the conspiracy to pretend everyone else can see imaginary colors
>>
File: 9azta45xkuv71.png (430 KB, 1920x1080)
430 KB
430 KB PNG
>>101521177
Sure, keep eating green bananas.
>>
>>101520925
mbed
>>
>>101516750
does red-green blindness exist on a spectrum or is it a binary switch?
I can't see a difference between 0% and 12%. Might just be my borked monitor settings though.
>>
>>101521177
>a more normal reaction is turning into a schizo
>>
>>101521578
schizo has come to mean "anything outside of the norm". Jews successfully brainwashed you into feeling shame within your own head.

i thank You God.
>>
File: freqs.png (69 KB, 600x482)
69 KB
69 KB PNG
>>101521497
It's a spectrum. Red and green colorblindness is caused by one cone type's peak sensitivity shifted towards the other, but the distance can vary greatly until total overlap is achieved. Slight shifts are usually classified as -nomalies (protanomaly, deuteranomaly, tritanomaly), total overlaps are -opias (protanopia, deuteranopia, tritanopia).
>>
>start git bash
>ctrl + mouse wheel up until font is like 5cm tall
>every single time
ah, the true boomer git experience
>>
File: 1720327744394561m.jpg (146 KB, 818x1024)
146 KB
146 KB JPG
What should I make for github portfolio. Currently I have nothing and also have no idea what impresses the employer.
>>
File: programming.ideas.png (380 KB, 1920x1080)
380 KB
380 KB PNG
>>101522252
>>
File: final_version.png (35 KB, 1530x968)
35 KB
35 KB PNG
>>101522252
Registry dumper.
>>
>>101522252
vectorize some fun algorithms
then port them to your GPU

no one needs a json parser that can handle gigabytes of json but that doesn't mean simdjson doesn't make the rest of them look retarded and shit
>>
>>101522280
Thanks chief
>>
>>101522565
this but for some obscure data format for which a simd implementation acrually doesn't exist yet
>>
>>101522772
yes, that's more what i meant, simdjson is just a really good example of the fun kind of stupid
>>
>>101521638
>da joos want you to believe certain colours exist!!!
embarrassing
>>
File: ugh.jpg (67 KB, 800x649)
67 KB
67 KB JPG
#include <typeindex>
#include <type_traits>
>>
it's purely crowdstrike fault
https://youtu.be/wAzEJxOo1ts?si=1kuXTWcOqVuYP8qJ
>>
>>101522921
>.t retard
>>
>>101524131
>doesn't prevent the virus
>crashes the system
That means it's working sweetie, now download your next definition file. Fortunately the experts (not you) are looking into it and C and C++ will be permanently banned as the NSA wanted.
>>
>>101524248
imagine being so much of a seeples cultist to convince yourself this makes sense
>>
>>101524485
C and C++ include is an awful piece of crap, using system.sonething is superior
>>
>>101524332
I could never understand the midwits who allow kernel level spyware on their machines. First it was "antivirus", then "anticheat" now rebranded as EDR/XDR. Stupid monkeys
>>
>>101524525
modules are already in C++, just not widely adopted. last time I checked support for modules in CMake was still shit.
>>
I am webdev with JavaScript and PHP experience, should I learn C++ or Rust
>>
>>101524551
name an operating system where drivers run unprivileged
>>
>>101524668
both are useless for webdev learn C#, Rust webdev is a tokio soup
>>
>>101524819
Oh so like I don't want to do webdev anymore, I want to make a porn game. Forgot to mention. And I don't know if I want to use Unity or any of those frameworks or whether I'd like to write from scratch.
>>
File: bomobe3dadca4l.jpg (13 KB, 242x242)
13 KB
13 KB JPG
>>101524860
C# and unity then, C++ and unreal have a higher learning curve and creating your own game engine in solo dev will take a few centuries (i'm looking at you blow)

some people will save godot but the C# plugin need to be rewritten to work properly with godot 4
>>
>>101524904
Alright, sounds reasonable. Thanks. You have helped to advance coomkind today.
>>
>>101497199
hey anon, sorry to get back to you so late
hope you're still around lol

my guess is that the image you shown is data from a .o file, something in-between C and raw assembly. The formatting tells me it's probably for debugging, the only time when anyone makes CLI that clean is when they need to know what the fuck it's saying in the first place.

My guess is that the instance where a function pointer is called is at the `vpcmpgbt`... thing. It's the only time in the program where it's used, and it passes reference to what I think are variables - one being %xmm0, another being %xmm1, and the third being %xmm12.

Keep in mind this is the first time I've spent actually analyzing this type of stuff. Keep in mind I'm a teenage high school graduate who just got done being underageb& and has been cooding for 2 years.
>>
>C and C++ will be permanently banned
I always wanted the USA to stop being a superpower, too.
>>
>>101525006
>I always wanted the USA to stop being a superpower, too.
>null pointer crippled the world
>keeping the null pointer good
>>
>>101525036
you fail to recognize how much our civilization hinges on C++. ban it, and you're back 40 years. you will never recover. you won't have time to.
>>
>>101524984
>something in-between C and raw assembly
It's objdump output. As in, a program that shows the actual bytes being fed to the CPU as well as their mnemonic interpretation.

>My guess is that the instance where a function pointer is called is at the `vpcmpgbt`... thing. It's the only time in the program where it's used, and it passes reference to what I think are variables - one being %xmm0, another being %xmm1, and the third being %xmm12.
That almost rivals the nonsense that GPT churns out on a regular basis. There's no function pointer being called here - the image just shows a bunch of bytes that are located at 0x140001C90 that happen to correspond to sense-making vector instructions: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions

The %xmmX stuff aren't variables so much as they're CPU registers: https://en.wikipedia.org/wiki/Processor_register
>>
Why is it that I can almost always remember the solutions to hard-level dynamic programming problems once I solve them or look up the answers, but for easy or medium-tier problems, like recursively finding a powerset, I tend to forget the solutions within a day?
>>
>>101525142
>dynamic programming
does it have any practical use outside of interviews?
>>
>>101525095
so ban it in new code. or at the very least, write code that passes static analysers and use memory safe libraries and stop using strcpy or passing pointers to buffers without a length. basic shit that apparently no one can do
>>
>>101525204
I would even argue that DP is probably the only topic thats actually quite useful outside of interviews since most problems you will face in real life wont be as simple as figuring out which DS to use, and then solving it with some gotcha algorithm that you have to remember.
>>
>>101525257
>so ban it in new code
that would prevent bug fixes in dependencies written in C++.
>write code that passes static analysers
these are very fallible. pointless requirement.
>and use memory safe libraries
who decides which ones are safe?
>stop using strcpy or passing pointers to buffers without a length
that's C.
>>
>>101525281
I've been in this business for almost 20 years, and have never heard anyone mention DP in any context outside of interviews. not once, in 7 companies I worked for.
>>
>>101525382
Well DP isnt some kind of data structure, its just a way of solving problems by dividing them into smaller more solvable problems. You've probably done a lot of DP before without noticing.
>>
File: memcpy.png (11 KB, 460x778)
11 KB
11 KB PNG
>>101525257
>stop using strcpy
Who uses strcpy? And for that matter, who uses memcpy, when in 99% of all cases two simple vmovdqu suffice?
>>
>>101525414
yeah, probably. same as when people are using design patterns without even knowing about them. I just don't get why we are putting so much attention to DP in the interview process. it seems like an elaborate IQ test. maybe that's the point. IQ tests are illegal in interviews in many places.
>>
>>101525431
they are not giving strings a maximum length of 64 bytes, they are doing byte granularity because that is what their processor taught them in uni.
>nooooooooooooo how could i waste that memory when there are another 64gigs
kek
>>
>>101525431
>picrel
why would I get involved with all this fuckery when I can just use memcpy?
>>
I honestly prefer solving problems with DP or recursion. It makes the code so much simpler and easier to debug in my experience.

Also does anybody use C# or dotnet outside of Windows? I tried it out, and I have to say there's a lot of things I like, but I don't want to use Windows. Or should I just use Java (or Clojure or Scala)?
>>
>>101525477
Usually you have to use multiple DS to solve a DP problem, so its more efficient to see if you're a retard or not.
Its better than an actual IQ test though since you can just practice until you know all the common patterns, while with an IQ test I dont think you can really study for one.
>>
>>101525495
>they are not giving strings a maximum length of 64 bytes
I was thinking more in terms of:
vmovdqu input,%ymm0
vmovdqu %ymm0,output

The rest is just making sure that you have 31-bytes overhanging, which is still about a thousand times simpler than having to deal with read and write granularity. If you have more data, then issue more vmovdqus:
vmovdqu input,%ymm0
vmovdqu input+32,%ymm1
vmovdqu input+64,%ymm2
vmovdqu input+96,%ymm3
vmovdqu %ymm0,output
vmovdqu %ymm1,output+32
vmovdqu %ymm2,output+64
vmovdqu %ymm3,output+96

, which is, sadly, still much, much faster than rep movsq or memcpy.
>>
>explanatory article on a topic
>example code is in an obscure and hard to read meme language
>>
>>101525825
Who doesn't know cinnameg?
>>
File: wtf.jpg (92 KB, 820x488)
92 KB
92 KB JPG
>give copilot non-trivial problem
>gives me something
>obviously doesn't work
>read into it
>try to understand it
>try to make it work
>time passes (way too much)
>still fixated on AI gibberish
>finally the realization comes
>"WTF AM I EVEN DOING???" (literally picrel)
>"DID I REALLY EXPECT THIS SHIT TO HELP ME WITH ANYTHING SUBSTANTIAL???"
>delete everything and do it as ancestors intended
I knew it wouldn't work yet I still fell for it. I feel ashamed bros. I can no longer blame the management for falling for the marketing and propaganda too.
>>
I'm working with a C API from inside a C# wrapper. the C API has a function with a signature like this:
void get_path(char* buffer, uint32 length)

and it fills the buffer with a path name. thing is, on the C# side, the char* is an
out string
, which has basically limitless capacity. what number should I use for the length?

it can't be too big because apparently the C side does some kind of validation, I tried the max value for uint32 and it crashed the whole thing. what is a reasonable value that will not fail 99.9% of the time? something like 4096?
>>
>>101526176
It's technically an unportable assumption, but PATH_MAX on Linux is 4096, and I think it's significantly shorter on Windows.
So yeah, using that is almost certainly fine.
>>
I'm reading through C++ Primer(third attempt this year) while using Claude 3.5 Sonnet to occasionally generate extra practice questions. It's working out pretty well so far.
>>
>>101525609
Ideally, when you have known alignments and lengths are suitable, memcpy would compile down into something like that. It doesn't always work out like that, and sometimes there are better ways to move things around that no compiler knows anyway.
>>
>>101498438
i now do heap and thread local storage

>NOTE HARDENING
kek, exec is 160 lines already, give me a break
probably gonna have wrappers local to (all) syscalls since in-kernel things are east
>*fast* syscalls
yeah funny joke, what the fuck was intel thinking???? obviously linux is a 15 million line behemoth when they have to get around this nonsense
>>
>>101498438
how can i do this in c++?
#define (x)(y)segment_alloc(size){      \                               
(xypool_alloc(size)-xypool)/sizeof(xypool*) \
}
>>
File: erp_mov.png (7 KB, 756x356)
7 KB
7 KB PNG
>>101526409
>memcpy would compile down into something like that
That would require memcpy to have knowledge about the maximum number of bytes the programmer expects the function to copy in the first place. I'm actually sitting in front of nginx code on a Gentoo machine (translation: specifically compiled for this CPU, distribution is not a concern) where the compiler just opted for a rep mov "optimization" instead, because it just has no way of knowing how many bytes it will end up copying.
>>
>>101526258
>I think it's significantly shorter on Windows
Yes, but some APIs accept significantly longer paths if asked right. It's horrible.
>>
>>101526595
>That would require memcpy to have knowledge about the maximum number of bytes the programmer expects the function to copy in the first place.
Sometimes it knows. Sometimes no. Fixed length copies are one of the common use cases for memcpy()
More awkward is whether it knows about the alignments of things. When you are copying aligned chunks of full words, you can do very good code. When things are misaligned, you end up with horrible stuff.
And sometimes there are HW accelerators that memcpy() knows nothing about, though that's more common in embedded processors.
>>
C++ was too free for America rip
>>
>>101519992
you don't.
you could use the 32 bit support if you want.
if you have one person who is able to download a dumping tool (or fumble around with task manager, it's easier if they just used windbg or procdump).
Note with 32bit binaries you MUST disable the frame pointer omission optimization to get usable stack traces (if you are releasing optimized binaries), also if it's optimized you don't want a full dump, so the dump is only like 20kb if you only store the stacktrace. You could disable inlining for accurate stack traces too.
You could have a mini-dumper that hooks to your unhandled exception handler, but it's not going to work with stack overflows, and I think you can't use anything that allocates memory in the situation the memory is corrupted (the malloc structure is borked).
And note that every dump must be exactly matched to the build of the game, which means when you release your binary, you should to use a separate project for dumps from that build (you probably need to embed the build version somewhere so you can keep track of it).
This approach can work for solo developers, but in a team you of developers and testers, there will be too many versions to keep track up, they need a symbol server and symbol indexing (AKA the dump file contains a script that finds the exact symbols + find the source code from the SVC). This is only easy to do in Azure's pipelines (and it's not really documented for C++, it's more for C#).
But that's only for full debug builds + 2gb large dumps (more than a stacktrace) + testers.
Developers probably use BugSplat which only works with stack traces, but it's good for privacy and large scales.
If your code is open source, mingw msys2 can print it's own <stacktrace> (C++20) when it reaches the unhandled exception handler. I hate mingw but embedded debug info is the only good thing it offers (msvc does not want you to share pdb files), just make sure to also handle the abort signal too. Don't use mingw for development.
>>
Is there a better way to write this function?

I use it for moving files to a folder which is the download_dir, but if a file in that folder has the same name it will append a (2), (3), (4) etc. at the end of the filename

def file_exists(filename):
file_path = download_dir.joinpath(filename)
counter = 1
# Remove leading circle brackets and number inside
formatted_filename = re.sub(r'\s*\(\d*\)$', '', str(filename))

#checks if current file with same filename exists, if true then append a number
while file_path.exists():
filename = f"{formatted_filename} ({counter})"
file_path = download_dir.joinpath(filename)
counter += 1

return file_path
>>
>>101522280
how long does it take to do number 79?
>>
>>101522280
>text editor with keybindings
EASY
>text editor without keybindings that registers a signal handler
OMG SO HARD
>>
>>101526176
Int16.MaxValue
>>
>>101526950
is there any point? it will never be atomic
>>
>>101525133
oh, thats cool :3

still idk how you expected me to know that - even if i claimed to know what a function pointer is. i dont know why you're bringing it up either, as this whole discussion has nothing to do with what i originally said lol
>>
File: roll.png (79 KB, 1291x528)
79 KB
79 KB PNG
>>101527541
If you don't know that function calls are "call <label>" and function pointer calls are "call <thing with OFFSET FLAT label>" then you are dumb, ugly, retarded, ugly, and have to do six registry dumpers, RIGHT NOW.
You can only have an opinion if you have a registry dumper.
>>
File: 1458546951680.jpg (47 KB, 474x479)
47 KB
47 KB JPG
>>101527660
>Image
>>
>>101527541
>still idk how you expected me to know that
It's not hard if you know anything about how binaries and machine code work in the first place.

>>101527660
The Temple OS registry dumper would easily go below seven seconds. Can anyone guess why?
>>
>>101526810
Care to elaborate?
>>
>>101527754
segmentation and every process shares the same context as the kernel

>would be easy if you know how binaries work
>.t midwit
you forget he probably had trouble with the placement of the code, function pointers are
mov function(%%rip),%%rax
and rip is not standard usable, there is a whole instruction for it
i guess call 0... is elegant though
>>
call +0 lol
>>
>>101527893
>segmentation and every process shares the same context as the kernel
It would help, but the actual reason would be that we could live-patch a broken kernel.
>>
>mfw nobody here reads SICP
>>
File: popcntless_popcnt.png (111 KB, 2153x437)
111 KB
111 KB PNG
https://arxiv.org/abs/1611.07612
huh
>>
Is there any evidence that supports cooperative multitasking for IO-bound (whatever that means precisely) applications on modern hardware and operating systems? If we focus on languages like Python, where only one thread at a time can run the interpreter, but many threads can sit blocked on a recv() call, or any call releasing the interpreter lock, are there any substantial performance characteristic differences with asyncio/greenlet event loop?
There is a 2002 microsoft research paper on the topic stating that manual scheduling with careful cache consideration is decidedly more performant in very specific circumstances, and equivalent to preemptive scheduling otherwise, but surely these modern language runtimes with task stacks heap allocated all over the place are not sufficient?

https://web.eecs.umich.edu/~mosharaf/Readings/Fibers-Coop-Tasks.pdf
>>
Im editing a massive project and need to add a global variable due to other functions. If I add it to the header of a file I get a multiple definition error, but if I add it to the cpp I dont have access to it. How do I get around this?
>>
>>101531291
/* header.h */
extern int my_global;

/* in ONE source file */
int my_global = 10;
>>
File: IMG_1803.jpg (2.37 MB, 3600x3000)
2.37 MB
2.37 MB JPG
>>101531291
>>101531317
inline variables in headers have been a thing since c++17
>>101527754
>>101527660
in templeos a registry dumper is just
Type("~/Registry.HC");
>>
>>101498438
>>101498438
how much work is too much work for a processor?
i am talking threads
>>
>>101531317
Sorry it takes like 10 minutes to compile and I had to try a few things. Your suggestion works along with a suggestions from other threads saying to define it as static. Static takes even longer to compile though and I get a lot of "variable not used" warnings.
>>
>>101531578
>irrelevant warning
turn it off
>btu its hbd to compile! D:
well then grow up and dont use a static variable, elf files were the doom of man
>>
>>101531578
If it's static, then it's not global over the whole program, and each translation unit has their own version.
>>
>>101530319
>whatever that means precisely
you do math faster than you can get things to do math on
and yes? probably more with things exposed as shared memory as opposed to kernel handles, it's why stuff like IO_uring exists
in fact reserving a unit of vector threads to act as a software driven scheduler for vector thread size * units of vector threads is a valid technique for increasing data throughput on the GPU
i think atomics are also a lot more efficient, i'm not even sure if processors had real lockfree instructions back in 2002, i've only ever worked with them at the ASM level on the GPU
>python
oh
no one should be focusing on python for anything vaguely related to multithreading, discussions relating to it aren't valid, full stop
i'm seriously tired of seeing pythonlets insert themselves into discussions like this
stop pretending python is a real programming language and learn literally anything else, python is basically the only one with these problems
even someone working in go would be have more relevance to the topic at hand

and nothing is stopping you from manually scheduling things preemptively in a speculative cache aware manner, this is particularly relevant in ML on consumer devices, i've glanced at a fair few papers relating to speculatively paging model layers on and off the GPU in order distribute to hide latency
that being said fibers/green threads in the old sense are actually dead, hell MS says the only recommended use of the fiber API these days is to allocate more thread local storage
actually modern windows libraries like C++/WinRT use tons of small customized cooperative schedulers all over the place, C++ coroutines (which are stackless) were originally a MS language extension, this is in part because windows has like 4-5 implicit thread local execution contexts and they handle shit like jumping through them implicitly
>>
>>101530319
>are there any substantial performance characteristic differences with asyncio/greenlet event loop?
Well, it has been shown that multithreading in Python is ... improvable: https://www.dabeaz.com/python/GIL.pdf
>The waiting thread (T2) may make 100s of failed GIL acquisitions before any success
If that sounds like the worst of both worlds that's because it is. Not only would a usermode scheduler wouldn't need to have its threads fight for GIL acquisition at all, but rather than each thread being stuck in a blocking recv call the main thread can call epoll (or whatever API you prefer) and only trigger reads for sockets that are guaranteed to succeed.

While one could argue that, since the GIL is released before I/O operations, there'd be an increase in throughput with multiple kernel threads (https://stackoverflow.com/questions/29270818/#tab-top), they would still block unless the kernel told you previously that they wouldn't. How does the thread know that? select+kernel threads scale badly and have additional mode switches, but they can execute in parallel unless you're running a Big Lock Kernel. epoll+kernel threads scale better, but work on multiple sockets, meaning a specific event has to be dispatched to a specific thread (additional locks and mode/context switches). epoll+user threads don't require locks (because it's one kernel thread running multiple user threads consequtively), don't require context switches (unless you're running more kernel threads than you should), and the mode switches are relatively light-weight (no TLB invalidation).
>>
>>101531643
I mention Python and the likes because there is no real parallel code execution with multithreading, and the only observable difference is in scheduling overhead. My original question was more about throwing a general case waiting-heavy workload onto an OS-scheduled thread pool, or some kind of event loop. I guess the question itself is flawed, and as always the solution greatly depends on the specific problem.
Thanks for the pointers, i will direct my research in that direction.
>>
use compiled languages is the answer.
>>
>>101531840
>My original question was more about throwing a general case waiting-heavy workload onto an OS-scheduled thread pool, or some kind of event loop. I guess the question itself is flawed, and as always the solution greatly depends on the specific problem.
oh yea that is a bit more tricky, i would look into io_uring performance and optimization since that's the biggest change in the space as of late
it seems to use an event loop over kernel shared memory with an option to add a secondary purely kernel mode thread
>>
>>101531840
I just cram all your shit into epoll, or maybe io_uring these days if you really want to get fancy.
>>
>>101498438
>tfw SINGLE_NOTES: is done
NICE, now LONGTERM_NOTES has only 12 entries....

>STUMBLING_REMINDERS has 8 entries
code quality am i right?
>>
>>101498438
Could any Cniles tell me why my code is so slow? I made a Go version of this and the Go version is twice as fast.

https://pastebin.com/cz0Bktq8
>>
>>101533139
>raylib
Yeah, no, you're on your own.
>>
>>101533139
>FPS gets lower with a smaller window
>
for (int32_t i = 0; i < totalParticles; i++) {
for (int32_t j = i; j < totalParticles; j++) {
...
DrawLineEx(start, end, lineThickness, color);
}
}

I don't know anything about Raylib, but I'm going to assume 1 use of that function = 1 draw call, which is inefficient as hell.
>>
>oring
>adds
once again, i am grateful for embarrassing myself for you guys.
Anyway help c++ wizards
>>
>>101533363
Take your meds, schizo-kun.
>>
whatever mate, i had changed the registers around earlier (because i was using 2 C variables to clobber and said "why the fuck")

anyway
void templ_receive_info(void){                  //this is hooked with constexpr to the low 16 operating system interrupts
ustd_t a;
constexpr num - 32;
__asm__ volatile(
"MOVq %%cr5,%%rcx\n\t" //data
"MOVq %%cr9,%%rax\n\t" //bit offset
"MOVq I0,%%rdx\n\t" //loading relative interrupt vector
"SHLq %%rax,%%rdx\n\t" //shifting and accumulating
"ORq %%rdx,%%rcx\n\t"
"MOVq %%rcx,%%cr5\n\t" //storing data
"JMP +0\n\t" //pipeline serialization
"ADDq $4,%%rax\n\t" //adding to the bitshift
"MOVq %%rax,%%cr9\n\t" //...
"JMP +0\n\t"
::"r"(a),"I"(num):);
if (a == 64){
request_data(void);
}
else{ halt(void);}
}

please help

Also does anyone have a resource on where immediate values are put? i have had shitcc put that I into cx...
>>
File: wwrong_trump.gif (437 KB, 480x287)
437 KB
437 KB GIF
flooding to prove it isnt schizofrenia
/*
This is the BSP portion of things*/
void serve_data(void){
Kontrol * ctrl = get_kontrol_object(void);
ustd_t local_apic = ctrl->lapic_override;

local_apic[0x280/4] = get_kontrol_object(void); //DANGER dont change things around in kernlib
ustd_t APid;
__asm__ volatile("MOVq %%cr15,%%rax\n\t" ::"r"(APid):);
poke_brother(APid,OS_INTERRUPTS::NOTIFY_DATA);
halt(void);
}
//THE ROUTINE:
void initialize_brothers(void){
ushort_t bsp_id = get_processor_id(void);
bsp_id = rotateRight((char)(bsp_id<<4),4); //now the low 4 bits are 0-3, the high 4 are 8-11...

for (ustd_t i = 0; i < bsp_id; ++i){
__asm__ volatile("MOVq %%rax,%%cr15\n\t" ::"r"(i):);
poke_brother(i,OS_INTERRUPTS::FIRST_SIPI);
schedule_timed_interrupt(4096,1); //waiting for a bunch of instructions before sending the other signals
poke_brother(i,32+((char)bsp_id));
>>
>>101533462
https://www.brunel.ac.uk/news-and-events/news/articles/Schizophrenia-Reading-ability-is-severely-impaired
>Schizophrenia: Reading ability is severely impaired
Makes sense. I'm not gonna read your ramblings either.
>>
>>101533489
just tell me how i can generate functions with immediate values as arguments in c++
>>
>>101533497
Inlining?
>>
>>101533522
still have to define 16 functions but i guess that works
thank you
>>
>>101533293
I don't think there is any other way to draw in raylib. 1 call = 1 draw. I could be wrong though as i've only been using it for a couple of weeks and my knowledge is lacking. Calculating the lines to draw before invoke the draw method gave me a couple of extra frames but my C implementation is still miles off the Golang one i've done.
>>
>>101533823
rtfm
https://www.raylib.com/cheatsheet/cheatsheet.html
void DrawLineStrip(Vector2 *points, int pointCount, Color color);                                  // Draw lines sequence (using gl lines)


But as the anon above pointed out drawing lines one by one is probably slow. Though you said the same implementation works fast written in go?
So you should try to profile your program and see where the slowness comes.
>>
>>101519594
Carmack
>>
>>101531577
should be written on the box
>>
>>101519594
stallman

ok he hasn't programmed anything for years but emacs is still my one favorite piece of software
>>
>>101534696
emacs is garbage, i cant even see the text i am typing
>>
>>101498438
>What Windows programs are you working on /g/?
kek, a golang cli tool for milkshaking solana charts
>>
File: ucq2oks2xqr71.jpg (17 KB, 411x325)
17 KB
17 KB JPG
>>101522280
>decide to make first green project
>have to read a whole fucking book about Markov Chain before I can start
Who the fuck made this shit
>>
>>101534942
Oh no, books?!?! Can you at least cap the qrd on the tok, fr?
>>
>>101534994
Bro if I have to read 300 pages every time I need a project for portfolio I will never make it.
>>
>>101499355
Tritanopia turns everything into the colours of the trans flag. The most based visual impairment. How do you feel about that?
>>
>>101533891
This draws one continuous line, no gaps and if you want to have individual opacity between lines you'll have to make separate calls to it anyway.
>>
>>101535290
Well plotting is generally bitch.
More optimal solution would group the parts and draw each group with single draw call.

But that has nothing to do with why the go implementation is faster, maybe the library does some additional optimization between the go API and C FFI.
Or the anon who posted the pastebin is lying fag.
>>
>>101535131
It's weird. Tritanopia is about the rarest form of colorblindness (bar achromatopsia), and most trannies will suffer a protan or deutan effect, rendering the trans flag as pretty much grayscale only.
It's almost like they're trolling themselves.
>>
>>101499707
>get told as soon as you can walk to wait until the traffic light is green before crossing the street
>never think about why you don't notice the light changing color at all
dunno man, I guess those are the same sort of people who watch 50,000 hours of TV and never notice that the media is run by Jews
>>
>>101535701
Mate, just google "peanut butter green".
>>
>>101498438
The basic shit in the Rust handbook (I'm getting back into programming after 7 years)
>>
>>101535091
>install okular
>click on the lef tbar (works on pretty much all pdfs after 2002)
>now can see all of the indexes and can click links to them
you dont need to *know* 300 pages word by word, you need to implement that and know by heart all of the concepts
>>
>>101533293
>I'm going to assume 1 use of that function = 1 draw call, which is inefficient as hell.
raylib's source code is very easy to read (and pretty much all 2D game libraries should be easy to read, there shouldn't be much going on).
When you use modern opengl as a raylib backend, raylib will emulate the fixed pipeline by allocating a large buffer and it will write every draw onto that single buffer, and it will batch the draw calls as long as you don't do anything that would break the batch (switching textures, changing blending modes, etc).
It's still not super fast but for 2D games, unless you are drawing like 1 million particles it doesn't really matter how you draw any of your code, you would need to accidentally enable software rendering or do something horribly stupid for anything to cause your FPS to go below 200fps on your optimized binary.
>>101533139
Also if you are benchmarking something that goes above 1000 FPS, you are wasting your time, anything could be causing a fps drop.
It could be only on your system, it could be for your compiler, or the flags (optimizations), or which library version (which opengl backend), or dynamic vs static linking, sprintf being slow (try using C++ and std::to_chars, or copy some 3rd party code that's fast in C).
You need to profile to know, the speed of the code doesn't matter if it's bottlenecked by the rendering, the rendering doesn't matter if it's bottlenecked by the CPU, and if the code runs 1000+ fps optimized, the performance doesn't matter because you are chasing ghosts, everything is a micro optimization, people are still buying PC's with 60hz displays like the newest macbook air's, and by the time affordable 1000hz displays come out, CPU's will run faster so it doesn't matter.
>>
>>101511989
Open the file as .txt
Recognize the pattern.
Then import as a big fucking string and do some magic. Experience has taught me it was far quicker to do this than to actually spend hours to (try to) learn some new gay Linux tier shit format that nearly nobody ever heard about. Did it, do it, will continue doing it. Actual working code in picrel.
>>
File: 1538165517039.png (291 KB, 557x459)
291 KB
291 KB PNG
i'm using chatgpt now because my employer encourages it
whenever i get assigned new tasks they are like
>anon here you go, you can use chatgpt for this
with context it is surprisingly good
>>
>>101537229
I've never had it give me any piece of code that worked. Always at least some error. But very good at understanding the general thing you brought up, and at directing you to resources, ideas, etc
>>
>>101537229
oh no, wrong tab sorry
>>
https://pastebin.com/i75z2rLX
>>
>>101537229
i have never asked it for a piece of code, all i know is that it has given wrong function names and pulled things out of reddit's ass when working with fucking gui frameworks of all things
>>
how do you deal with code / notes in multiple places while you're developing?
i'm doing my first big boy job and i've got two servers i SSH into (one's general purpose and the other is for GPU workloads), plus my own local development on my laptop.
and often i have my own personal laptop for testing shit because i can only use local-admin through power shell which is really fucking annoying sometimes.

so i've got 4 places where code is, and sometimes i'll make a quick temporary folder on my desktop or whatever to see test something out, etc. plus i've got text documents with commands in them, like shit to run to build a docker container, or other repetitive lines to copy+paste.

it's a fucking mess. shit is everywhere. how do you keep your stuff organized?
>>
The fuck do cool dpters use to write their code nowadays, are you guys still sucking rust's cock
>>
>>101537380
use an IDE
it can organize all your projects, manage dependencies, do pretty much any repository/version control action, integrate all your shell and debugger connections, as well as make developing itself trivial and focused on the actual task
>>
>>101533497
consteval wrapper classes?
worked for me when metaprogramming amdgpu asm
>>
>>101537629
yeah but consteval relies on things being called, these functions get called in a way the compiler understands a total of 0 times, i think function pointers might be a way to stop "optimization", something like:
Class
virtual function(constexpr VECTOR) : BASECLASS.num;


though what i actually have right now is
#define B(c) funcname(x)
constexpr auto * bspid_interrupts[] = [B(0),B(1),....]
(constexpr because the functions that pipe into idt and gdt are unrolled, kernelcode_start + function pointer)
>>
File: 732.jpg (321 KB, 1494x1200)
321 KB
321 KB JPG
>mfw meta-programming
>>
File: Sad2.gif (1.78 MB, 400x279)
1.78 MB
1.78 MB GIF
I'm tired, ui programming is tiresome, at least the ui work properly, i still have a few more pages and buttons to program..
>>
>>101538558
at least you can see the results of your work in a reasonable amount of time lol
>>
>mode switches and memory caches encourage bulk processing
>"file streams"
The standard people were never targeting consumer hardware, were they? Then why do we keep using their shitty APIs?
>>
>>101527660
>two sum O(1)
wat
>>
>>101538980
if you can't implement adder in vhdl/verilog in O(1) you need to get out
>>
>>101538739
>file streams
As in IO? I think they work well... file streams are used at the hardware level too after all
>no
then what is it you mean? are you schizofrenic?
>>
>>101539200
>are you schizofrenic?
No, unlike you I don't suffer from dyslexia and can write the word "schizophrenic" just fine.
>>
>>101539307
ok boomer, how about you get off your high horse and clarify what it is you meant?
>>
>>101539337
Would you first clarify where you got the information that streaming is used on a hardware level? They're also called "block devices", after all.
>>
I fucking hate MSVC so fucking much bros. I am considering ditching support for it completely.
>>
>>101539455
>host OS holds communication line
>keyyboard cant communicate
do you want to lose user input?
.yes -> yangmi
.no -> use a buffer
the buffer is what the file stream is, the interrupt is SIGIO
source: ps/2 keyboard and mouse controller pdf i found on the internet with accurate descriptions of pinout and stuff

Now explain what you meant
>>
>>101539589
>host OS holds communication line
?
>keyyboard cant communicate
???
Keyboards and mice are character devices, you utter mong. We're talking about file access from block devices.
>>
>>101539694
soooo.... you are complaining about the fact that context switches exist... right.
You dont have anything valuable to tell me, i dont want to talk to you
>>
>>101539867
I don't think I've ever seen some as clearly mentally ill as you are in /dpt/, and by the gods, that means something.
>>
>>101539897
>gaslighting
you are criticizing things you are ignorant on, why are butthurt that someone called you out on it?
>>
The fact that you even brought up the term shows you're not confident in your feeble grasp of reality.
>>
>>101540105
>>101540105
>>101540105
New



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