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


Old thread: >>92165696

What are you working on, /g/?
>>
Making bank nigga you know what I’m sayin u feel me nigga u want a loan???? Sike!!!! Ahahahahha
>>
>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. It's because data are immutable so the only way to store every next operation's result is to create new values. In particular, every iteration of a recursive computation creates a new value. But GHC is able to efficiently generate garbage, so it's not uncommon to produce 1gb of data per second.
>>
>>92185524
it's true
>>
>>92185474
Just removed Pust and Python support from my general programming language parser for highlighting... Feels good man.
>>
>>92185474
tryna learn SICP but honestly i don't like this scheme bullshit, at least not yet.
>>
>>92185509
Nigger.
>>
>>92185653
Better than Pust "language" marketing threads.
4chon is anime based image board kiddo...
>>
>>92185653
You're more than welcome, encouraged in fact, to fuck off.
>>
>>92185722
>>92185626
based but namefag so it cancels out
>>
>>92185474
>What are you working on, /g/?
rewriting a C++ game engine in C
>>
>>92185731
Shut the fuck up trannypedo shill.
>>
>>92185474
>What are you working on, /g/?
rewriting a C++ compiler in Rust
>>
File: new_keys.gif (467 KB, 600x338)
467 KB
467 KB GIF
NEW KEYS!
Waddaya think?
>>
>>92185857
Half of it is missing. Paul Allen wouldn't make that mistake.
>>
File: paul_allens_keys.gif (3.02 MB, 540x304)
3.02 MB
3.02 MB GIF
>>92185873
Yea he would.
>>
Im trying to make a simple risk limit type check
but every time i run this it gets the value double wrong and runs the first if statement even when it shouldn't any ideas?
class RiskLimitProcessor
{
public:
void AddLimit(const std::string& instrument, double maxValue, int maxVolume10Seconds, double maxValue1Second)
{
double value = maxVolume10Seconds * maxValue1Second;
if (value > maxValue) {
std::cout << "MAX_VAL_LIMIT " + instrument << std::endl;
return;
}
if (maxVolume10Seconds > value) {
std::cout << "MAX_VOL_10S_LIMIT " + instrument << std::endl;
return;
}
if (maxValue1Second > maxValue) {
std::cout << "MAX_VAL_1S_LIMIT " + instrument << std::endl;
return;
}
}

void ProcessOrder(const std::string& instrument, uint64_t timestamp, int volume, double price)
{
std::cout << "NO_LIMITS XXX" << std::endl;
}
};
>>
Reminding anons to use https://github.com/friendlyanon/cmake-init when creating new C++ and C projects!
>>
File: file.png (323 KB, 1280x720)
323 KB
323 KB PNG
>>92185474
figuring out how game maker engine works.
on a side note
>CRaticalHit
>>
File: nice.gif (813 KB, 340x144)
813 KB
813 KB GIF
>>92185912
>https://github.com/friendlyanon/cmake-init
>his CMake solution is better than mine
>>
>>92185912
Thanks I’m still using cargo.
>>
>>92185912
#!/bin/bash

set -xe

clang -ansi -Weverything -g -Ofast -o xarbon xarbon.c -lpng

No...
>>92185970
You can shit your penis in a cargo to Taiwan. (:
>>
>>92185982
* ship, not shit... maybe both...
>>
>>92185908
In Rust this is just
pub fn add_limit(instrument: &str, max_value: f64, max_volume_10_seconds: i64, max_value_1_second: f64) {
let value = max_volume_10_seconds as f64 * max_value_1_second;

match () {
_ if value > max_value => println!("MAX_VAL_LIMIT {}", instrument),
_ if max_volume_10_seconds as f64 > value => println!("MAX_VOL_10S_LIMIT {}", instrument),
_ if max_value_1_second > max_value => println!("MAX_VAL_1S_LIMIT {}", instrument),
_ => (),
}
}

pub fn process_order(instrument: &str, timestamp: i64, volume: i64, price: f64) {
println!("NO_LIMITS XXX")
}
>>
File: impressive-very-nice.gif (2.58 MB, 640x464)
2.58 MB
2.58 MB GIF
>>92185982
>1 source file
>>
In my main.c, I have
#define MY_TYPE struct shape

(the struct is defined there as weel)
I then import my header file do_stuff.h, where I use
void modify(MY_TYPE* array)

But when I try to compile it, gcc shouts at me that
error: unknown type name ‘MY_TYPE’


Why is that? All the other macros defined in the main seem to work in do_stuff.h, but not this type.
>>
>>92186002
It's a very simple program. It's just a general parser, with PNG image import and export, and keywords and types of C, C++ and Ada, rendering source code file as PNG and printing it to terminal in colour (highlight).
>>
>>92186007
is the macro defined before #include? anyway i think that's still disgusting
>>
>>92186007
typedef struct shape MY_TYPE;
>>
>>92186007
why not typedef?
>>
>>92186001
how would you do the match statement in C++?
>>
>>92186077
Coming in C++26 i believe
>>
>>92186007
>is the macro defined before #include?
Yes.
>>92186043
>>92186046
Unfortunately, I'm required to allow for the type to be #defined, not by my choice.
For some reason,
typedef MY_TYPE my_type
can't compile with the same error.
>>
>>92186007
Don't use macros for that. That's what typedefs are for.
But it sounds like things are defined in the wrong place/order.

A header is essentially copy-pasted into your file, so the order things appear in is important.
void modify(MY_TYPE* array);

typedef struct shape MY_TYPE;

is going to fail.
Put the typedef in the header itself.
>>
File: 16638546753140.jpg (2.11 MB, 2894x4175)
2.11 MB
2.11 MB JPG
>>92185908
>>92186001
So i just need to check in C++ if the value(volume*price) is above the thresh hold, and print MAX_VAL_LIMIT
if the volume total in ten sec is more than the threshold i should print MAX_VOL_10S_LIMIT
if total value of all orders in one sec period exceeds the threshold i should print MAX_VAL_1S_LIMIT
but for some reason my code is saying a threshold is reached when it clearly isn't given the input

class RiskLimitProcessor
{
public:
void AddLimit(const std::string& instrument, double maxValue, int maxVolume10Seconds, double maxValue1Second)
{
double maxV = (double)maxVolume10Seconds;
double value = (double) maxV * maxValue1Second;

if (value > maxValue) {
std::cout << "MAX_VAL_LIMIT " + instrument << std::endl;
}
if (maxV > maxValue) {
std::cout << "MAX_VOL_10S_LIMIT " + instrument << std::endl;
return;
}
if (maxValue1Second > maxValue) {
std::cout << "MAX_VAL_1S_LIMIT " + instrument << std::endl;
return;
}
}

void ProcessOrder(const std::string& instrument, uint64_t timestamp, int volume, double price)
{
std::cout << "NO_LIMITS XXX" << std::endl;
}
};


Given:
LIMIT ABC 100.0 1000 100.0
ORDER ABC 10000000 10 8.0


I should be printing something like:
MAX_VAL_1S_LIMIT ABC


But instead my prog returns:
MAX_VAL_LIMIT ABC
MAX_VOL_10S_LIMIT ABC
NO_LIMITS XXX
NO_LIMITS XXX
>>
>>92186117
> I'm required...
Sorry to say this Anon, but...
I believe that you're either a college student, or some one you work for is very dumb...
>>
>>92186129
Since I'm required to let MY_TYPE be #defined, my code in the header now looks like this:
typedef MY_TYPE my_type;

void modify(my_type* array);

The same error with unknown type name happens on the first of these lines.
>>
>>92186167
>Since I'm required to let MY_TYPE be #defined
I hope this isn't some retarded requirement for some university thing where the teacher themselves knows fuck all.

I'm guessing struct shape isn't declared up until that point either. It needs to be declared before then, or you can just forward declare it.
struct shape;
typedef MY_TYPE my_type;

void modify(my_type* array);

This lets the compiler know that struct shape exists, but you'll give the definition of it later.
>>
>>92185644
>honestly i don't like this scheme bullshit
You don't have to, lisp is pointless. There's js Sicp, but I think it's not really a must-read.
>>
>>92186265
>I hope this isn't some retarded requirement for some university
Unfortunately that's the case.
Idk I'll probably just submit it as it is for now.
>>
File: 1582141718681.png (12 KB, 166x166)
12 KB
12 KB PNG
>>92186150
My bad i misread the question, now im just getting the limits and checking using processOrder method, but im getting an error where i get the VAL_1S response twice, any ideas?
class RiskLimitProcessor
{
public:
double maxValueTLocal;
int maxVolume10SecondsLocal;
double maxValue1SecondLocal;

void AddLimit(const std::string& instrument, double maxValue, int maxVolume10Seconds, double maxValue1Second)
{
maxValueTLocal = maxValue;
maxVolume10SecondsLocal = maxVolume10Seconds;
maxValue1SecondLocal = maxValue1Second;
}

void ProcessOrder(const std::string& instrument, uint64_t timestamp, int volume, double price)
{

int value = (volume * (int)price);

if(value > maxValueTLocal){
std::cout << maxValueTLocal << std::endl;
}
if(volume > maxVolume10SecondsLocal){
std::cout << "MAX_VOL_10S_LIMIT " + instrument << std::endl;
}
if(maxValue1SecondLocal > price){
std::cout << "MAX_VAL_1S_LIMIT " + instrument << std::endl;
}
else{
std::cout << "NO_LIMITS XXX" << std::endl;
}
}
};
>>
> dwm/config.h
I think I should separate terminal and renderer into 2 programs...
One is like a coloured 'cat' with syntax highlighting, other not quite...
>>
>>92186483
class RiskLimitProcessor
{
public:
double m_maxValue{};
int m_maxVolumeTenSeconds{};
double m_maxValueOneSecond{};

void AddLimit(const std::string& instrument, double maxValue, int maxVolume10Seconds, double maxValue1Second)
{
m_maxValue = maxValue;
m_maxVolumeTenSeconds = maxVolume10Seconds;
m_maxValueOneSecond = maxValue1Second;
}

void ProcessOrder(const std::string& instrument, uint64_t timestamp, int volume, double price)
{

const int value = (volume * (int)price);

if (value > m_maxValue) {
std::cout << m_maxValue << std::endl;
}
if (volume > m_maxVolumeTenSeconds) {
std::cout << "MAX_VOL_10S_LIMIT " + instrument << std::endl;
}
if (m_maxValueOneSecond > price) {
std::cout << "MAX_VAL_1S_LIMIT " + instrument << std::endl;
}
else {
std::cout << "NO_LIMITS XXX" << std::endl;
}
}
};


some minor mods
>>
File: synt.png (272 KB, 823x940)
272 KB
272 KB PNG
Revolutionary syntax highlighting... (:
>>
what do anons think of pic related?

not you xolatile you're a crazy person
>>
>>92187089
I fucking hate OOP patterns, copy_if is super simple and I do not give a fuck about your "dependency inversion" or your "architectural boundaries"
>>
>• Comments and whitespace are used to format a program to make it visually clear, and in some cases (like Python) are significant to the structure of a program.
Just read this, thought it was about indentation, asked chatgpt, got
>Comments, on the other hand, are not significant to the structure of the program in the same way as whitespace.
So what was meant in the first quote?
>>
File: 1676491480814530.png (779 KB, 1920x1080)
779 KB
779 KB PNG
>>92187118
kek someone is mad

>it's le comblicated
>let's just abandon it due to brainlet-ness
>>
>>92187187
>misses the point
>wojak faggotry
>rust trannery
>reddit spacing
this post really has everything
>>
File: 1679231708341477.png (885 KB, 1920x1080)
885 KB
885 KB PNG
>>92187197
Everyone who bitches about "plebbit spacing" is a fucking nocoder bitch.
>>
>>92187211
>nocoder
Go back to adgdvg or however you spell it
>>
>>92187211
>>92187187
Hello my fellow redditor.
>>
>>92187211
Boost.Unordered is far superior to std:: and whatever botched garbage trannylang has.
>>
glad to see /dpt/ is still complete dogshit
>>
>>92187118
if you don't have some notion of DIP you can't PURPOSELY design algorithms that allow you to swap out the predicate. This argument is essentially anti-intellectual. What you are saying is that people should "just know" everything about good software design from... what? years of writing shitty programs?

That is fucking retarded.
>>
>>92187556
Nobody needs to give a shit about your arbitrary reframing of shit as "dependencies" and "dependency inversion". It is easy to write higher order functions/procedures in C++
>>
Any c# pros here? Given the classes:
public class Person
{
public string Name { get; set; }
public List<Address> Addresses { get; set; }
}

public class Address
{
public string Country { get; set; }
public string City { get; set; }
}


And let's say I have been given the following Expressions for both classes:
Expression<Func<Person, bool>> personExp = personQuery.Value(); // e.g., matches where name eq "john smith"
Expression<Func<Address, bool>> addressExp = addressQuery.Value(); // e.g., matches where city eq 'new york' and country eq 'usa'


Is there a way to combine those expressions into a single Expression<Func<Person, bool>> that will match all the conditions? In this case it will be equivalent to the condition person.Name == "john smith" && person.Addresses.Any(a => a.City == "new york" && a.Country== "USA"))
>>
>>92187616
ohh so you just prefer your super sheshul FP bullshit terminology instead? k

perhaps you should have said something similarly constructive to start with.
>>
>>92187639
It's not bullshit terminology, it's JUST terminology. It has an exceedingly simple meaning, it puts on no airs. A higher order function takes a function as a parameter or returns one as a result. That's it. I'm not saying you need to understand higher order functions to write them.
>>
>>92187623
idk but I hope you post more, it's interesting.
>>
>wake up at 6:20am
>watch youtube videos and youtube shorts
>3pm

Time to code guys haha
>>
I HATE JUNIOR DEVS
I HATE JUNIOR DEVS
I HATE JUNIOR DEVS
>>
>>92187885
go to wdg retard
>>
>>92187897
>all juniors are web devs
dumb fag
>>
>>92187913
if he were saying something along those lines it would be haters of junior devs, not juniors
>>
>>92187885
Why do you hate me so?
It's not my fault I'm a brainlet
>>
File: 1672992401815242.jpg (24 KB, 400x400)
24 KB
24 KB JPG
>>92187927
>It's not my fault
>>
>>92185912
For me it is
https://github.com/rust-lang/cargo
>>
>>92187973
Every time I push I shit myself because I know the person doing my code review will shit on me.
This had the impact of increasing my suicidal thoughts and decreasing my will to live.
>>
>>92187623
Maybe something like this?
Expression<Func<Person, bool>> f(Expression<Func<Person, bool>> e1, Expression<Func<Address, bool>> e2) =>
person => e1.Compile()(person) && person.Addresses.Any(e2.Compile());
>>
How long should I stick with C++ before switching to Rust?
>>
>>92188327
switch to C
>>
>>92188327
What are you making?
>>
>>92188026
tighten your sphincter, and recognize that getting shit on in code reviews says more about the reviewer than you. if you see poorly written code the correct response is to fix it yourself, that's what version control is for
>>
>>92188395
C is pretty cool too
>>92188396
malware
>>
>>92185474
Lisp is the most powerful programming language.
>>
>>92188567
For malware, you want a language and toolchain that's hard to decompile and analyze.
Both C++ and Rust (LLVM) are bad because they're so widely used that tooling is too good.
Look for something more exotic.
>>
I'm sorry but I hate vim and emacs, it's so hard to navigate. I'm going back to vscode
>>
Is there a Rust macro or something that would allow me to do this automatically for an arbitrary struct type?
let (nigger1, nigger2, nigger3) = getNiggers();
let niggerStruct = NiggerStruct( nigger1, nigger2, nigger3);

So initialize struct from a tuple.
>>
>>92188867
Woops, syntax error. Meant NiggerStruct{nigger1, nigger2, nigger3} ofc
>>
>>92188877
>NiggerStruct
Who builds nigger structures?
>>
>>92188867
pretty sure the rust compiler won't compile the code if it has word "nigger" in it.
>>
>>92189101
How does it check for niggers if it does not allow niggers?
>>
gcc -nostdlib -nostartfiles -s -o program main.c

Bloat purged. Seethe trannies.
>>
>>92189128
it compares the symbol name to every word and if it doesn't match any then it assumes it's nigger
>>
>>92188567
C and python are what malware devs use, ignore all other advice
>>
>>92186077
poorly
>>
>>92186150
no help for pedos
>>
I need to stop programming on sundays. THis isn't healthy.
>>
>deadline tomorrow
>half of the features are not implemented
it's over for me bros
>>
>>92189351
Just fire them first
>>
File: 1fb.png (273 KB, 600x583)
273 KB
273 KB PNG
>>92188431
I HATE SENIOR DEVS

I also hate working

>>92189351
>deadline monday
>it's sunday
>only 50% complete
Why are you only panicking now?
>>
>>92189479
He can't work today, it's the sabbath
>>
>>92189351
>deadline the following day
>swap to folding char
>close all blinds
>don't eat, just pour myself a cup of water and begin working
>finish after 10 hours
ez
>>
>>92189560
I'm not telling him to work, I was just surprised because it looks like he's panicking now when he should have been panicking since monday lmao
>>
>>92189614
yeah well I have been drunk the whole week and I can't test anything without office equipment
>>
>>92188114
Thanks but unfortunately that didn't work, however the following does work:
Expression<Func<Person, bool>> expr = p => p.Name == "John Smith" && p.Addresses.Any(a => a.City== "new york" && a.City == "USA");

So the two must not be the same. I'll keep trying
>>
Codesisters, how do I call a private constructor in C++? Don't ask why, I have to do it but can't change the class it's in.
>>
>>92190222
get its location on the vtable, dereference as a function pointer and call as you otherwise would
https://www.youtube.com/watch?v=HClSfuT2bFA
>>
bros i'm trying to write c and i'm getting segfaults every edit this is impossibly hard
>>
File: tj09e2g8n0k91.jpg (58 KB, 700x656)
58 KB
58 KB JPG
which programming language is for strong men?
>>
>>92190516
fighting is for fools
>>
>>92190503
im bored
post the code, ill find the segfault for you
>>
>>92190551
Already nuked but I will describe it as a very ill fated attempt to build a generic vector using void pointers. Fuck void pointers. In fact fuck pointers too. Doubly so for pointers to pointers.
>>
>>92190516
Common Lisp
>>
>>92185474
HOLD MY HAND
WHILE I LEARN NIN
>>
void* filtered_anon = (void*)>>92190681;
>>
>>92190681
>attempt to build a generic vector
for what purpose?
>>
>>92190765
you can't see the utility in a generic vector?
>>
>>92190785
i technically do, but no situation comes to mind when i couldnt use something else, so i would have to implement it.
sounds to me like you are inventing problems to solutions.
>>
>>92190897
what the fuck are you talking about I use generic vectors all the time
>>
gpt will eventually replace most of you, so what do you plan on doing?
>>
>>92190959
AI will never replace programmers
>>
>>92190222
kek you don't.

but if you wanted to, you would probably just type erase the memory of the object, locate the ctor and call it.

Also, those objects are usually obtained via a singleton getter function... If you aren't a fool.
>>
File: Spλrtλ.png (710 KB, 2272x2560)
710 KB
710 KB PNG
>>92190516
Lisp is the most powerful programming language.
>>
>>92190544
then you should be doing lot of fighting
>>
>>92189725
You need to take the expressions apart, then combine the pieces into a new one.

// Given these
Expression<Func<Person, bool>> personExp = p => p.Name == "John Smith";
Expression<Func<Address, bool>> addressExp = a => a.City == "New York" && a.Country == "USA";

// Combined expression, we want to build this:
Expression<Func<Person, bool>> expr = p => p.Name == "John Smith" && p.Addresses.Any(a => a.City == "New York" && a.City == "USA");

// Use the same parameter expression instance
var par = personExp.Parameters[0];

// Build the second part: p.Addresses.Any(...)
var andAddressAny = Expression.Call(typeof(Enumerable), "Any", new[] { typeof(Address) }, Expression.PropertyOrField(par, "Addresses"), addressExp);

// Combine into a single expression
var fullExp = (Expression<Func<Person, bool>>)Expression.Lambda(Expression.AndAlso(personExp.Body, andAddressAny), par);

>>
File: c90.jpg (26 KB, 680x564)
26 KB
26 KB JPG
>>92190544
>uhhh ackshually I'm le ebin ligma male because I let my family get raped and murdered by german barbarians
le ebin roman stoic mentality
>>92190691
>>92191093
how do I into lisp to become one of you strong men?
I bench 315, but now I want to do the programming equivalent.
>>
>>92191541
it's not 400 AD anymore
>>
>>92191541
There's no programming equivalent of benching 315
>>
>>92191582
It's worse
stop being a goycattle slavepig
>>
>>92191955
Stop ruining fitness by associating it with culture war LARP.
>>
>>92191955
Yeah I'm sure you need to fight to defend your trad christian family or whatever your conservacucks are larping as these days
>>
>>92191966
Shut the fuck up. Lifting is about improving yourself. Programming is a skill and it improves you.
You're a tranny.
Men should not ever be weak slaves. That is not a culture war, that is a fact ordained by God.
And I will not longer be weak in programming. I will be strong everywhere.
>>92191971
>conservacucks
>implying I would ever fall for the false demon religion of politics
kek. Politically I'm simple. I'm pro human, pro american, anti evil. I think so lowly of slave to the religion of politics that you do not even realize how funny your accusation is.
You do not even realize you serve the same demon head as those which you disdain. You are equally pathetic subhumans in my eyes.
And yes, I refuse to go out with a fight if anyone is trying to harm my trad christian family.
Are you really saying you would betray your family? You would not risk your life for them?
That is the most pathetic thing I have ever heard.
I just want to know the strongest language from the stongest men, not listen to some egotistical cuck needing to humiliate himself because if he didn't he wouldn't know he was real.
>>
>>92192160
I don't need to risk my life for my family
Programming isn't about strength, it's about creativity
You will accomplish nothing in programming by doing reps
Now fuck off and go hang out with your low IQ buddies on /pol/
>>
>>92192193
>implying I would waste my time on a zionist honeypot propaganda machine ran by the feds
kek, you lack of prediction shows your low intelligence.
You are foolish to thing that the method of struggling and overcoming in the gym is different than anywhere else in life. Strength is strength, no where should we desire to be weak when it can be helped.
I will do reps of programming tonight.
>>
>>92192293
You can do programming reps, but that won't make you a good programmer, which I assume is what you think "strong" is
You'll never move past the beginner phase unless you're actually solving problems, its completely different to weight training which requires no creativity whatsoever, just work
>>
>>92191365
Thanks so much, that seems to have solved all my problems. There's a lot about expressions/lambdas that I just don't understand, guess I need to do some studying
>>
>>92192193
You will always be weak.
>>
>>92190222
probably using friend, but I don't know if it would actually work because I never used this feature.
>>
>>92192439
tell that to my bank account
>>
File: soyjak angry.png (20 KB, 225x225)
20 KB
20 KB PNG
>>92192193
>Now fuck off and go hang out with your low IQ buddies on /pol/
>>
>>92192458
Why would I talk to an absence of money you fucking retard
>>
>>92192531
thats not what i was implying
>>
Write code in the middle of your sets.
>>
>>92187556
Wha the fuck do you mean by predicate?
Give an example.
>>
How do I modify this script so it evenly distributes the files within "src_dirs" to the "disks ="? Right now the code parses through "/mnt/disk1/Backup/Music" then distributes it to all "disks" equally in a round robin way then goes on to do "/mnt/disk2/Backup/Music" next and then "/mnt/disk3/Backup/Music" and then "/mnt/disk4/Backup/Music".

But this ends up creating uneven amount of files across the destination locations. Because of the way the script goes through disk1 to disk4, disk1 ends up having the most files and disk4 with the least files.

import os
import shutil

# Define the paths of the disks
disks = ['/mnt/disk1/Backup/Music', '/mnt/disk2/Backup/Music', '/mnt/disk3/Backup/Music', '/mnt/disk4/Backup/Music']

# Define the paths of the source directories
src_dirs = ['/mnt/disk1/Backup/Music', '/mnt/disk2/Backup/Music', '/mnt/disk3/Backup/Music', '/mnt/disk4/Backup/Music']

# Define a variable to keep track of the current disk index
current_disk_index = 0

# Recursively walk through the source directories and move files
for src_dir in src_dirs:
for dirpath, dirnames, filenames in os.walk(src_dir):
for filename in filenames:
src_path = os.path.join(dirpath, filename)
# Get the next disk path in a round-robin fashion
current_disk = disks[current_disk_index]
current_disk_index = (current_disk_index + 1) % len(disks)
dst_path = os.path.join(current_disk, os.path.relpath(src_path, start=src_dir))
# Create the destination directory if it doesn't exist
if not os.path.exists(os.path.dirname(dst_path)):
os.makedirs(os.path.dirname(dst_path))
# Move the file to the destination directory
shutil.move(src_path, dst_path)
print("Moved {} to {}".format(src_path, dst_path))
print("Finished")
>>
>>92190516
>>92191541
C, as in Casting iron.
>>
>>92189700
presumably this is how he got into this situation
>>
>>92193257
you want to have those disks to have about the same amout of file or about the same amount of total bytesize?
>>
>>92193426
*number of files
>>
>>92193426
same amount of files across all 4 directories and distributes then in a round robin so the files are move to disk1 then disk2 then disk3 then disk4 from foldername/filename alphebetical order
>'/mnt/disk1/Backup/Music', '/mnt/disk2/Backup/Music', '/mnt/disk3/Backup/Music', '/mnt/disk4/Backup/Music'
>>
>>92193480
same number of file?
>>
>>92193451
>>92193494
yes I currently have this below and want to distribute them evenly so they have the same number of files, kind of like a balancer
'/mnt/disk1/Backup/Music' - 67 files, 12 folders
'/mnt/disk2/Backup/Music' - 137 files, 25 folders
'/mnt/disk3/Backup/Music' - 363 files, 53 folders
'/mnt/disk4/Backup/Music' - 496 files, 78 folders

currently what I'm doing is consolidating all files/folders into disk1 then running the script which does the job but would like it to work without having to consolidate into a single disk.
>>
>>92185474
Kyouko is pure sex
>>
>>92193257
>>92193702
How about consolidating the file paths to a single list and splitting that to four parts? Then move each part to its own directory. Sort it to get alphabetical order.

Or read the number of files, and then read files and move the first N/4 to the first directory, and then the next N/4 to the second etc. Associate the N/4 with a name in a second pass if you need alphabetical order.

Or choose a random drive for each file. Have more files to make it more accurate.
>>
I'm pretty shit at planning my personal projects. Is there some pointers or book I can read to improve on this? I end up mutilating a file until it does something that I'm satisfied with and then just glue more stuff on top of it. I can't phantom larger systems at all.
>>
>>92193702
import os

current_disk_index = 0
disks = ['/mnt/disk1/Backup/Music', '/mnt/disk2/Backup/Music', '/mnt/disk3/Backup/Music', '/mnt/disk4/Backup/Music']

src_dirs = ['/mnt/disk1/Backup/Music', '/mnt/disk2/Backup/Music', '/mnt/disk3/Backup/Music', '/mnt/disk4/Backup/Music']

files = []

for src_dir in src_dirs:
for dirpath, dirnames, filenames in os.walk(src_dir):
for filename in filenames:
files.append(os.path.join(dirpath, filename))

files = sorted(files, key=lambda file: os.path.basename(file))

for file in files:
# print(file)
current_disk = disks[current_disk_index]
current_disk_index = (current_disk_index + 1) % len(disks)

print(f"{file} -> {current_disk}")
# insert the copy/move instruction here
>>
>>92193895
Unironically start writing simple tests and documentation. It will save you time
>>
>>92193895
>then just glue more stuff on top of it.
welcome to programming
>>
File: DeusEx.jpg (57 KB, 800x450)
57 KB
57 KB JPG
if I remove an element from the middle of std::vector, does that resize/rearrange the other elements? e.g the vector contains 1, 2, 3, 4 and I remove 2, does that move 3 and 4 down the list?

If so, what's the best container for random access that lets me remove things O(1), but doesn't necessarily need quick lookup? std::list?
>>
>>92193885
>How about consolidating the file paths to a single list and splitting that to four parts? Then move each part to its own directory. Sort it to get alphabetical order.
Thats what I'm doing and it works but if it becomes unbalenced again I'll have to consolidate the files/folders again and its not really effcient way when you have 100k files on some of the folders I have.
>>
>>92194121
If you don't care about the order of elements, you can remove an item by swapping it out with the last item for O(1) removal in a vector
>>
>>92194145
what ends up in the last space, then? nullptr, I guess?
>>
>>92194172
you reduce the length of the vector by 1
>>
>>92194183
does that resize the underlying array? Or just changes the logical end of it?
>>
>>92194217
that depends on how C++ works, that's just a general technique for removing elements from vectors
typically no it doesn't resize the underlying array
>>
C and Java are the only languages that matter
>>
>>92194121
intrusive linked lists are an option, this is an example of one (note GPL, but technically speaking I don't think it has any real legal issues because ID didn't invent linked lists, and I think it's more likely you will get in trouble for trying to take credit for it by removing the copyright notice, and this structure can easily be replaced if it was a problem):
https://github.com/Edgarins29/Doom3/blob/master/neo/idlib/containers/LinkList.h
>>
>>92194051
I agree with that, but at the same time, what if the plan i had falls through because the tech doesn't scale and I have to rewrite a ton?
>>92194075
Yes, but the glueing isn't usually as grotesque.

I guess I do want to document but more beforehand and then work from that, instead of just perpetual prototyping?
>>
>>92194423
why would you steal linked list code instead of writing it yourself
>>
>>92194245
W Chad opinion
>>
>>92194121
>>92194145

Okay, that worked, thanks for the help. For posterity, here's my implementation. My application is single threaded, so I add all my "to remove" items to a different vector during the main loop so that I'm not modifying the main vector while iterating through it. Then, I go through each item in the "to remove" list, find it in the main list, swap it with the end of the main list, resize and delete.

    for (auto it = m_removedEntities.begin(); it != m_removedEntities.end(); it++)
{
// find entity in main list
auto entIter = std::find(m_entities.begin(), m_entities.end(), *it);
//get last item
auto lastIter = std::prev(m_entities.end());
//swap
std::iter_swap(entIter, lastIter);
//resize
m_entities.resize(m_entities.size() - 1);
//delete underlying pointer
delete (*it);
}
// clear "to remove" list
m_removedEntities.clear();
>>
>>92195755
can you save the index of the to-be-removed items instead? would save you the find()s.
also consider using smartpointers or something similar to point to your entities.
>>
File: code.png (241 KB, 1922x1080)
241 KB
241 KB PNG
Wrote a program in python to write dick size with a scale

o, instead of having to type out the size of your dick,
you use a sliding scale between 6 and 15 inches, select, then hit the submit button to generate text on the size of your dick. you can copy + paste the text so that you can quickly quickly state your dick size faster in dick threads.

copy of the code for you bros:

from tkinter import *
our_window = Tk()

def our_submit():
print("my dick is " + str(our_scale.get()) + " inches" )

#create a sliding scale from 6 to 15 dick inches.
our_scale = Scale(our_window,
from_= 15,
to=6,
length = 300,
font =('Times New Roman', 14),
tickinterval = 1)
our_scale.pack()

our_button = Button(our_window,
text='submit',
command= our_submit,
)
our_button.pack()

our_window.mainloop()
>>
I'm a data scientist who really only needs to know python for my job. What language should I learn if I want to learn one for shits and gigs and don't really plan on learning it for helping me get a job? I know a little bit of C/C++ but probably only to the level of a CS 101 class if that.
>>
don't mind me just posting illegal integers
0xBEEFBABE
>>
>>92196055
reported
>>
>>92196055
>illegal integers
we're going to build the bitmask and they are going to store it
>>
>>92195951
>can you save the index of the to-be-removed items instead? would save you the find()s.

Once I swap elements in the vector, the indices become corrupted. I'd have to store references to the index and update the indices when I swap.
>>
>>92195960
wrap your code in \[code\] blocks, like

\[code\]print("fuck")\[/code\]

becomes

print("fuck")
>>
File: 4hxqbdzyffla1.jpg (539 KB, 2010x2015)
539 KB
539 KB JPG
>>92196055
0xB16B00B5
>>
>>92196417
I think if you remove them in descending index order you don't corrupt anything
>>
>>92196438
>\[code\]
thanks, also i added a resolution so that you can have a dick measurement to the .1 scale for more accuracy :)
\[code\] from tkinter import *
our_window = Tk()

def our_submit():
print("my dick is " + str(our_scale.get()) + " inches" )

#create a sliding scale from 6 to 15 dick inches.
our_scale = Scale(our_window,
from_= 15,
to=6,
length = 300,
font =('Times New Roman', 14),
tickinterval = 1,
resolution = .1)
our_scale.pack()

our_button = Button(our_window,
text='submit',
command= our_submit,
)
our_button.pack()

our_window.mainloop()
\
\
>>
I'm going to take a programming class in the summer.

Would it be wise to do it online class with chatGPT as my tutor or do a zoom class so I can interact with the professor?
>>
>>92194121
>if I remove an element from the middle of std::vector, does that resize/rearrange the other elements?
Yes.

>If so, what's the best container for random access that lets me remove things O(1), but doesn't necessarily need quick lookup? std::list?
No. std::list is not random access.

https://en.cppreference.com/w/cpp/container/list
>std::list is a container that supports constant time insertion and removal of elements from anywhere in the container. Fast random access is not supported.

std::map or std::unordered_map is likely a better choice. Use the container selection guide for questions like this.

>>92195755
You've literally just re-implemented the library function remove but poorly.
https://en.cppreference.com/w/cpp/algorithm/remove
>Removing is done by shifting (by means of copy assignment (until C++11)move assignment (since C++11)) the elements in the range in such a way that the elements that are not to be removed appear in the beginning of the range. Relative order of the elements that remain is preserved and the physical size of the container is unchanged.

Sometimes called the erase-remove idiom.
>>
>>92196570
Yeah you were supposed to remove the \ from the code block
>>
[/code]
from tkinter import *
our_window = Tk()

def our_submit():
print("my dick is " + str(our_scale.get()) + " inches" )

#create a sliding scale from 6 to 15 dick inches.
our_scale = Scale(our_window,
from_= 15,
to=6,
length = 300,
font =('Times New Roman', 14),
tickinterval = 1,
resolution = .1)
our_scale.pack()

our_button = Button(our_window,
text='submit',
command= our_submit,
)
our_button.pack()

our_window.mainloop()
[code\]

retrying^ for dick slider
>>
File: 9.png (3 KB, 614x460)
3 KB
3 KB PNG
I have developed tridejur.ddns.net/searchchan.php indexing stable difusion of /g/ board also have not finished testing tridejur.ddns.net/correo.zip
>>
>>92196639
>Yeah you were supposed to remove the \ from the code block
thanks, retrying:
from tkinter import *
our_window = Tk()

def our_submit():
print("my dick is " + str(our_scale.get()) + " inches" )

#create a sliding scale from 6 to 15 dick inches.
our_scale = Scale(our_window,
from_= 15,
to=6,
length = 300,
font =('Times New Roman', 14),
tickinterval = 1,
resolution = .1)
our_scale.pack()

our_button = Button(our_window,
text='submit',
command= our_submit,
)
our_button.pack()

our_window.mainloop()
>>
File: 1672975520486730.jpg (113 KB, 1200x1190)
113 KB
113 KB JPG
>>92196602
>Use the container selection guide for questions like this
What the fuck are you talking about schizo, I'm not looking at the same website as you are
>>
>>92196680
>>92196656
>>92196570
>>92195960
Average Python developer everyone
>>
>>92196602
>You've literally just re-implemented the library function remove but poorly.
No he hasn't, he's implemented a different form of remove
>>
Pyton is shit is the same shit with different name
>>
File: capsule_616x353.jpg (117 KB, 616x353)
117 KB
117 KB JPG
>>92196602
>>Removing is done by shifting (by means of copy assignment (until C++11)move assignment (since C++11)) the elements in the range in such a way that the elements that are not to be removed appear in the beginning of the range. Relative order of the elements that remain is preserved and the physical size of the container is unchanged.

That seems like what he explicitly didn't want to do. He doesn't care about relative order and shifting is going to take longer than swapping a single element, which he did
>>
>>92185474
def func(str):
for c in str:
print(f"char: {c}")

Why the fuck does this print the entire string?
>>
>>92197131
did you accidentally wrap your string in a list or 1-element tuple or something?
>>
>>92197131
Isn't str the name of a builtin function in python?
You should probably call it something else.
But the code seems to work fine for me. Make sure you're actually passing the argument that you think you are as >>92197204 says.
>>
File: .png (48 KB, 180x180)
48 KB
48 KB PNG
>>92197204
>>92197221
apparently the string was actually of type "list" because I was using splitline when reading the stdin.
even though it would print out as a regular string.
>>
>>92197131
dynamic typing is a mental illness
>>
>>92197362
Hard to disagree.
>>
>>92197362
it's based in lisp but useless everywhere else
python should just make a 4.x version that turns the type hints into real static types
>>
>>92197362
You've convinced me to switch to Go
>>
>>92185474
nakadashi toshinou kyouko
>>
>>92191093
Lisp weenies like to think that.
>>
>>92197802
>t. ayano
>>
I'm wanting to help create a way to install non-steam apps through a package manager, and have the launcher automatically added in the deck's UI. It would also contain the cover artwork and controller mappings.
However, I don't want to put up the packages myself or host a server. I've written a small python program that demonstrates these ideas, and will flesh it out if people have a use for it.
https://github.com/0x0000ff/steam-pkg-manager
I'm unsure of who to approach with my proposals, and will actively avoid reddit. Steam forums doesn't seem to have a community for steamos hacking and development. Anywhere else I can turn?
>>
File: imInDanger.gif (1.86 MB, 462x268)
1.86 MB
1.86 MB GIF
>get a new job
>it's a non-junior position
>realize my previous senior programmer was shit and I've learned almost nothing
>realize my code is almost as bad as it was in the start
>realize I don't know half the shit people take for granted
>>
File: 1676246641950687.png (1.24 MB, 1242x1394)
1.24 MB
1.24 MB PNG
FUCK OOP
>>
>>92199566
I definitely feel like I'm getting worse from employment, boomerware sucks
>>
>>92186002
>worshipping complexity
>>
>>92200301
>wanting praise for 1000000000 file poo in loo terminal calculator
>>
>>92199219
can't you just use pacman or AUR?
also this is a /sqt/ /fglt/ question
>>
File: 1654896814065.jpg (420 KB, 756x756)
420 KB
420 KB JPG
spent 4 hours debugging my C hash table by prining the memory contents and function calls
first error was using *HashEntry instead of **HashEntry
second error was failing to properly prepend an element in a linked list
all this time I thought the free chunk list overwrote something

I don't care I'm not stopping, I just wish there was a some heap visualizatin displaying pointer as arrows, in the general style of the animations made by 3Blue1Brown
>>
>>92200714
doesn't C have debuggers?
>>
>>92200714
>3Blue1Brown
I hate this stupid faggot piece of shit like you would not believe.
He literally pretends like he invented math videos on youtube.
fucking jew
>>
>>92200714
>second error was failing to properly prepend an element in a linked list
C compilers have type checking. Surely it would pick this up, unless you were retardedly throwing void pointers into the mix..
>>
>>92200734
yes but I don't know how to use them properly outside of stepping, breakpoints and backtrace
>>92200788
his animations are pretty cool though, but he's using a software someone else made
>>92200797
it was the wrong type but still an error because I'm retarded
the conditional was also useless
    if (prepend_to_existing_chain) {
entry->next = ht->bucket[slot]->next; /* the error */
entry->next = (struct HashEntry *) ht->bucket[slot];
}
else {
entry->next = NULL;
}
>>
>>92200955
>it was the wrong type
the right type
>>
1% of productivity goal achieved
is fucking over
>>
>>92190516
tradcucks have gone from "i consider myself a scholar" to "i hate scholars and want to kill them" in all of 6 years
>>
File: china1679004004316136.jpg (613 KB, 1997x2187)
613 KB
613 KB JPG
>>92200714
>I just wish there was a some heap visualizatin displaying pointer as arrows
you could print graphviz instructions

printf("digraph g {\n");
for(whatever)
printf("%p -> %p;\n", p, p->next);
printf("}\n");


myprog | dot -Tpng >myprog.png
>>
>>92201055
it wasn't the right type if it was a pointer to a pointer and you passed a pointer. my C lsp warns about that and both clang and gcc will
>>
What's the best git hosting for "free speech"?
>>
>>92196597
No thoughts?
>>
>>92203157
None.
>>
Why do I never see early returns in Lua code? I don't like these big indentation towers.
>>
Is there anything in the C++ STL which I can use to join a vector of elements with a delimeter? I know how to do it myself, but I'd rather not unless I have to.
>>
>>92189153
Insanely based
>>
What's the best Rust learning resource you guys have come across? I'm not really happy with the official book or any other textbooks I've tried when it comes to explanation of ownership and specifically lifetimes. They all seem to try teaching via negativa to justify the behavior of the compiler when I just want an explanation of rules, semantics, etc so on. I got really pissed when I saw an example in two separate books that basically did something liike
let a = "foo".to_string();
let b = a;

Semantically as per my understanding this assignment moves the contents of a to b. Every book I've read explains "well this WOULD be a copy, and just assume it is, but then rust invalidates the memory when those bindings go out of scope and that would cause a double free!!!!".

Like, just tell me that its a move man. I know this sounds like a minor nitpick but the entire chapters on ownership just keep doing this like this and it gets more and more convoluted. Tell me what I need to know to use the language and not what I need to know to actually implement the language on my own.
>>
>>92200714
Son, do yourself a favor and use a simple open-addressing table, preferably without making any allocations (let the caller manage the buffer) https://nullprogram.com/blog/2022/08/08/
>>
>>92204794
here he goes again
>>
>>92204809
> use a simple, performant and easy to implement design?
> nah, lemme just make a mess with linked lists, probably with an allocations happening on each insert and then slowly walk that linked list for lookups, all of which is harder and more error prone to implement as well.
yeah bro, sounds like a great idea.
>>
>>92204922
enjoy your clustering
>>
>>92204759
programming rust by o'reily
they do this roundabout way so you can understand the difference between bindings and variables and values
and that = is the move operator and that moving a binding into a binding on a non-Copy is just a rebinding
>>
>>92204759
This is my fucking pet peeve with every programming languages documentation and every tutorial ever written.

>Here is how to not do things
>Here is the old way of doing things 19 years ago that you'll see in legacy code bases that you won't be working on because you're learning the language not being hired with 10 years of experience to maintain a legacy code base
>Here is the old way of doing things from 8 years ago, same deal as above.
>Here is one way to do it but it isn't the idiomatic way that everyone who actually writes code will do it
>Here is another way to do it but it makes the code less extensible by overengineering the problem. You might occasionally see code written like this and it was probably written this way because it solves some weird niche edge case you should never have to worry about yourself
>Finally here is the idiomatic way to write the code

And now, as a beginner, you constantly fuck up and don't remember the syntax for the "correct" way of doing things because you were taught 7 fucking different ways of doing the same thing. Teach me how to write good code. If I see code that isn't good code - I can infer it is either (1) solving a unique problem so had to be written this way, (2) legacy code, or (3) bad code.

Why is it so hard to find a tutorial for prog langs that isn't the author jerking themselves off for having 20+ years of experience dealing with how things used to be done?

Webshit is even worse at it. React took 6 fucking years to update their documentation to be hooks-first and only hooks and not teach you the legacy junk first THEN try and teach hooks.
>>
>>92205272
>Why is it so hard to find a tutorial for prog langs that isn't the author jerking themselves off for having 20+ years of experience dealing with how things used to be done?
Answered your own question. There's some weird catch-22 where an expert is simultaneously the best and worst person to teach anything. Because to an expert everything is obvious and they are the furthest away from being able to relate to a beginner. And at the same time they are the most knowledgeable on the topic.
>>
>>92204543
views::join_with
>>
>>92205396
Every now and again I come across the rare gem.
>Here is how to do it
>Here is the way most beginners think it should be done and here is why it is bad
Importantly - the correct way is mentioned first and the error is explained. All documentation I write for work is 3 dimensional to avoid this issue. The happy path continues --> and if someone needs more technical or less technical explanations they can move up or down a level for that topic before continuing. The high level should be dumb enough that the project manager should understand it. The low level should be technical enough that any seniors would notice issues with implementation details to be corrected. The mid level is written at the level of devs we onboard. Onboarding is extremely smooth - with most devs that weren't bootcamp code monkeys becoming proficient with the code base within 2 months.
    Higher level/less technical explanation
^
|
Topic being Explained ---> Next topic --> Next topic
|
v
Lower level/more technical explanation

This should be the industry standard - but I'm also in a unique position that my company has a team paid whose sole job it is to write the documentation... from what I've heard of other companies - that isn't the case and you're often lucky to have any documentation written at all above the bare minimum to get a project signed off on.
>>
>>92205607
Sauce on those rare gem tutorials
>>
What do you think is the best option for a portfolio/cv of a junior dev?
> React - Flutter
Or
> React Native - Flutter
>>
File: render.jpg (1.36 MB, 2560x1387)
1.36 MB
1.36 MB JPG
Normal maps
>>
>>92205722
I work primarily in web dev. If it wasn't written in the past 6 months it may as well not exist because none of the examples are going to work for the version you should be learning. So most of those rare gems are no longer relevant and have long since been replaced by more shitty tutorials.

One rare gem is for Easy 6502:
https://skilldrick.github.io/easy6502/
>code is already there
>you can assemble and run it
>you're even encouraged to step through it and modify things to see what your modifications end up changing
>it fully explains what is happening for each line of code
>that's fucking it. no weird errors, no gotchas, only working code
>look it's fucking Snake
>here's how every line of the game works
Flawless and fun tutorial for an easy and fun ASM.
>>
>>92205853
I wrote "for 6502 ASM" originally and meant to edit it to be "is Easy 6502" but left the "for", woops.
>>
LITTLE BROTHER’S AT IT AGAIN!!!
>>
>>92185474
Writing a rust rfc
>>
>>92185474
Googling rfc
>>
>>92205056
>he thinks open addressing == linear probe
>he doesn't know about double hashing
>inb4 "cache misses"
try profiling first. and you can always use robin hood if you really want to linear probe.
>>
>>92206631
>try profiling first
Take your own advice.
>>
>>92205812
fuck off
>>
>>92206657
already did, chained tables (even when the buckets are an array instead of a linked list) always perform significantly worse than a double-hashed (using the high bits of the hash as the increment) open-addressing table.
>>
>>92206704
truly a 130iq obsession
>>
File: file.png (699 KB, 1400x474)
699 KB
699 KB PNG
You may not like it, but this is what an ultimate lifeform looks like
>>
>>92206901
>>
>>92205607
sounds neat
do you use any special format or layout/structure to make the navigation between levels easy? Or is it just "each chapter has a topic section, higher level section that you can skip and lower level section that you can skip" ?
>>
What is the path to work in cybersecurity as a software engineer ? Do I need certification to apply for these kind of jobs ? I dont really know where to start, was planning on reading books and doing lot of ctf
>>
Elden Ring save copier anon here, hope you are doing well. I came back from work and started working on the port straight away.

I started working on the CLI frontend now that the core i/o has been ported.
I'm happy to announce that porting to rust has significantly improved the performance.
The original C# app would lag for almost a second when you select and parse a save file.
My rust port does that instantly in a debug build.

Please recommend me a GUI library with wayland touch support (for steamdeck) bros.
So far I am looking at
1. iced-rs. Very pleasant MVU paradigm. Zero tutorials, but active help discord. Well documented
2. dioxus: React paradigm. Not my favourite but it has a solid documentation and tutorials. Active help discord. But I have to write CSS all by hand.
3. Egui: reminds me of gtk2, but simpler. Not sure it supports wayland.

The reason I am not going with GTK is that I
1. I intend to ship it to windows as well and cross compiling gtk is horrible.
2. I am tired of gtk callback hell.
>>
File: 1662300396419.png (2 KB, 277x309)
2 KB
2 KB PNG
>>92207009
Think of a page that looks like this but better designed and not 3 seconds spent in Paint. Since we're onboarding our devs we explain what the up/down navigation do. They should generally be fine sticking "on the main track" but if they want to understand something at a lower level they can descend and if they only need a brief overview of what something is they can ascend a level.
We found this better than splitting it into three sections on a single page. Most devs don't get much benefit of the high level documentation (those mostly exists for our less technical teams anyway) and junior devs would often get confused by the lower level documentation (that they also don't need because they shouldn't be needing to care about implementation details...). But that documentation is important for senior devs and the devs who are working on those parts of our systems - so it is important we have it.
>>
>>92207734
Also the reason the mule file and my save file looks the same is because I haven't created any new character in the game since I copied the save last time.
>>
>>92207734
Afaik all the rust gui libs suck right now. I'm attempting to write my own for that reason, hopefully I can get it to suck a bit less.
>>
>>92207766
That's very cool, I wonder what renderer you are using for windows and text. Good luck anon!
>>
>>92207766 (me)
Any opinions on gui padigrams that you like or dislike?
>>
>>92207783
I dislike old callback soup (GTK, wxwidget, Qt et al)
I very much like the MVU paradigm (Elm, Relm, Iced etc).
>>
>>92207734
Added a little bit soul/easter egg on the cli version for shits and giggles xD
>>
>>92207780
Thanks. I'm planning on writing a gl or vulkan renderer to start with, text rendering is going to take more investigation, but I know its going to be a pain in the ass no matter what I do. Last I checked none of the current main ones worked with an IME, and iced couldn't display anything but ascii (this was 6 mo ago).
I say I've started already because I want to dynamically link the library by default for style plugins and small app size, and the rust ecosystem is shit for this, so I've been working on improving that situation first by making FFI libraries. ("Finished" the first one yesterday).

>>92207798
Interesting, MVU is the pattern where you generate a new widget tree and send the whole thing in for a repaint right? I was planning on doing a handles-owned-by-context model, but callbacks in rust are somewhat worse than other languages due to borrowing. What parts do you like about the MVU pattern?
>>
>>92207849
It results in concise and well organized code.
I like that I only have to worry about passing a message on an event, and it'll execute the relevant update function. So clean. no ugly callbacks.
>>
>>92206665
¿?
Thats why the ai will fuck you all.. you can't answer a simple question. Fucking nerds!
>>
>>92207923
So you use a message queue to pass message objects instead of using callbacks, then switch the handler based on the message in a dispatch function, and from there rebuild the widget tree?
>>
>>92207949
That sounds about right, anon.
>>
>>92207959
Alright, I'll add it to the list of patterns to experiment with. I figure I have to actually try multiple patterns first instead of just implementing bullshit, since most of my gui experience is java swing, and I don't want to replicate that.
This is the same model flutter uses right? I think I watched some presentations on it.
>>
>>92208002
Internally, yes. Flutter API however is callback based. Have a look at the elm architecture
https://aaronerhardt.github.io/relm4-book/book/
>>
>>92208048
Thanks, I'll add it to my random unorganized links file I've been collecting.
>>
>>92208048
Additionally, do you have any takes on style plugins? I'm trying yo figure out a balance between user choice and application choice.
>>
>>92208184
I like this
https://github.com/iced-rs/iced/blob/master/examples/styling/src/main.rs

But I guess more advanced stuff like backdrop blur is a sign of a polished UI library.
>>
>>92208265
Imo that seems overly limiting. Ideally I'd like to make something thats overly generic in what the underlying renderer is (renderer could be custom vulkan renderer or win32), and expose trait interfaces of varying detail depending on how many things you want to target.
In this case with style I'm somewhat referring to general layout. I think it could be interesting to be able to implement some generic traits and have the toolkit try to match the target platform, though this of course breaks down once you do something complex.
>>
>>92208317
That sound like a lot of work, anon. Good luck, not too familiar with graphics programming myself but I know the more customization means more complexity.
>>
(Designing this without insane amounts of scope creep is hard of course)
>>
>>92208350
Yeah I'm not expecting to be done any time soon. Planning on a multi year project, and I'm just now laying the foundations (usable ffi types and traits library).
I've had this as a pet idea for at least 3 years now so it feels good to be working on it though.
Thanks for the advice and feedback anon!
>>
>no arduino general
it's truly over arduinocels
>>
>>92204809
why are you so butthurt I suggested you use open addressing over linked lists
I'm not the same guy, that's someone else
>>
>>92208378
>>>/diy/mcg
>>
>>92200558
pacman can only be used in developer mode on steamos. Would have to use something like appimage or homebrew packages in user mode.
>>
idk about web dev but i want to use web UI for I/O, i've written the code in c++ but looking at webdev for c++ seem to be a lot of reading so i learn go to try web stuff, some people suggest using python i'm not used to to dynamic typed language i prefer static for now that's why i choose go, any shortcut for doing it in go?
>>
Which Python profiler do you guys recommend? Currently using cProfile, seems good enough.
>>
if connect fails on a socket, why can't I reuse the socket anymore? I still have to close it so it's not like connect closed it. what exactly has happened to make it unusable, but still 'active'?
>>
>>92210092
>I still have to close it so it's not like connect closed it
Unpredictably closing file descriptors outside of explicit calls to close() really has the potential to fuck with programs. So things just leave file descriptors in a "dead" state for you to clean up yourself later.

>what exactly has happened to make it unusable, but still 'active'?
I'm not exactly sure about what the standard says about this situation or if that's even the behaviour, but maybe just having the sockets become useless makes it easier to the implementation side, or did so for some implementation in the past.

sockets shouldn't be hideously expensive to recreate, so I wouldn't really think too much about just closing it and making a new one.
>>
for(int i = 0, j = x; i < n; arr[i] = j, i++, j += x);

>single line iterator in python LE GOOD
>single line iterator in C... LE BAD
>>
i'd like to make a GUI text editor in python, what are all the useful resources that'd help me?
>>
>>92207825
So.. I finished the CLI frontend too. I can now got to sleep, it's 1 AM and I have work tomorrow.

I can finally wipe my windows installation in peace.

>>92207734
GUI library recommendation welcome!
>>
>>92210890
I have opened the source
https://github.com/pubnoconst/er_mule_copier
>>
>>92210757
Do you really have to talk like that?
>>
File: 323.png (6 KB, 735x96)
6 KB
6 KB PNG
>have a huge list of points
>need to do some elliptic curve multiplication on those points
>parallelize it
>profile it
>get pic related as results
>wtf parallelizing it must be horrible
>don't parallelize it
>takes 34768345 times longer
Am I retarded (yes), or is this profiler fucking with me?
>>
>>92211604
from what I'm getting, acquire is the 'wait till it's your turn' command
doesn't mean parallelization is bad, means your parallelization is bad
it spends most of its time waiting, find out why
>>
>>92211233
When I am mocking others, yes.
>>
>>92212151
The only thing you're mocking is a strawman you made up in your own head
>>
>>92190222
find the address of the constructor and call it
not sure what the function signature is on non-MSVC ABIs but for MSVC depending on object size it's either object constructor(params...) or object constructor(memory*, params...)
if you can get the mangled name of the symbol you could use clang's __asm() aliases to create an alias to the constructor
>>
Does anyone know how well C/C++ compilers optimize goto?
I am generating C code, and it's easier for me to generate gotos than regular control structures like if/for/while, but I'm wondering if I should do that anyway because the compiler can optimize them better
>>
>>92207430
cybersecurity is just rebranded IT mixed with disaster mitigation unless you're doing unironic glowy shit like malware research
and for that, i have heard, not sure how true it is, that you're supposed to try and get a job that says applicants "must have or be able to obtain security clearance" regardless of how shit it is as getting security clearance is your ticket in, it's apparently much more important than any certification
>>
>>92212568
>not publicly humiliating the voices in your head
>>
Rewriting BASIC -> PR1ME Fortran -> ANSI C adventure game from 1970s, written by ? and modified by Mike Arnautov...
It's full of magic numbers, this was written before C had enumerations, and convertor didn't care to abstract them, pain.
Variable names also have "assembly syndrome", same as C syntax... It's fun none the less. (:
>>
>>92213491
>you're supposed to try and get a job that says applicants "must have or be able to obtain security clearance"
what does that even mean?
>>
https://vlang.io/
do you guys use V?
>>
>>92214556
V sucks, and V developers lied to users in the past.
>>
>>92214824
what else should i learn instead? i got shilled by a yt video about being able to create cross platform UI app that's light-ish weight
Zig? Nim?
>>
>>92214549
it means it's a job that wants someone who has permission to or is able to get permission to work with classified material
https://www.state.gov/security-clearances
there are a fair amount of requirements, i think you have to be sponsored by someone (hence the purpose of applying for jobs like this), you are subject to rigorous background checks, and you also get to be actively monitored by intelligence agencies for what is probably the rest of your life
but it opens the door to a lot of specialist jobs for which there isn't much competition, they can't hire outsource like they usually do as US citizenship is a requirement
>>
>>92214868
yeah, I got that part
but how do you go about getting the clearance
do you just start small at a company and get promoted to a core member?
>>
>>92214308
puts inserts a newline. Your printfs should add some \n's.
>>
>>92214933
you apply to a company that requires it for your position and they advocate for you to get it. my process was this
>get job
>get sent details on where to go and documentation
>get fingerprinted / background check
>get clearance a couple months later
>>
>tfw too dumb to write specs and design software
>>
>>92215005
oh, so clearance is an actual thing like a government certificate
sorry, I thought it was more like a company-specific NDA
boy am I dumb, Thanks!
>>
File: 66.png (108 KB, 491x368)
108 KB
108 KB PNG
Pythonsirs, i need some advice on how to browse tuples. For a week ive been trying to come up with a method to allow me to unpack objects and process the data but the possibilities are limited.
Im seriously thinking about saving my data to sqlite (or h2, dunno if you can use that on python) then write methods that are wrappers to sql queries (ive worked with sql in the past and know the queries i need).

Any ideas? Maybe you can do some 300 lines pure python method but i dont have time for that. SQL could solve my problem right now.
>>
>>92214945
I'm making 'echo' function that will also automatically insert a new line, plus have a colouring of text with VT100 escape codes. (:
I also want to figure out what those magic numbers are, and name them properly, it'll take a while but I'm doing this for fun.
I find this "old C" programming style way cleaner than my Ada-inspired verbose style.
>>
>>92215386
Also sirs, i have another design question:

>should i make a facade to a methods factory?
>inb4 use default args
No, thats limited functionality. I need to change the method based on the amount of args passed to the method:

def facade_method(args, kwars):
if(arg):
return query_1(arg)
if(arg, arg):
return query_2(arg,arg)
if(arg, kwarg, kwarg, kwarg):
return query_3(arg, kwarg, kwarg, kwarg)
...
>>
>#include <iostream>
tell me you get no bitches without telling me you get no bitches
>>
>>92215630
#include <format>
>>
>>92214843
pls respond
>>
>>92216676
First mistake in my humble opinion is CROSS PLATFORM, second, is getting opinions from the internet (Jewtube and chan)...
I don't want to be rude, so I avoided talking more crap about V, Pust, Python, C++ etc., but really, you need to experiment yourself.
If you think C is cool, try it out for 1 month, if you can't handle it, try something else. You shouldn't impose time constraints on yourself.
> especially when you're learning something new...
I dislike C a lot, but I dislike all other languages except Ada even more, so I write C, ANSI standard, because of lulz.
That being said, I have a real (non-programming related) job as a guard, and I write programs for fun, that only I like and use...
For example, this is game made in 1975, rewritten several times in different languages over the last 48 years.
Now I'm rewriting it for fun, cleaning all compiler and linter warnings, testing with Valgrind etc., and adding "advanced" terminal support.
>>
>>92217265
>First mistake in my humble opinion is CROSS PLATFORM, second, is getting opinions from the internet (Jewtube and chan)...
how else am i meant to discover new things? where should i be getting opinions from?
>CROSS PLATFORM is a mistake
why is this a mistake?
>I don't want to be rude, so I avoided talking more crap about V, Pust, Python, C++ etc., but really, you need to experiment yourself.
I am experimenting myself I am just asking what else is the alternative, Go is great but it doesn't feel like I am suppose to build UI with it

what is your gripes with V in general? why even hold back talking shit, give me your rundown on why you think it is bad and your experiences with it

I just want to CONSOOOOM knowledge
>>
>>92217381
> How else am i meant to discover new things?
Search the internet for options, not for opinions.
> Where should i be getting opinions from?
First from other people, then from the internet.
> Why is this a mistake?
Because you need to deal with a lot of artificial complexity.
> What is your gripes with V in general?
I get tired of C sometimes, and check new languages out, but they're either unfinished, unstable or slow to run or to compile.
V language had a lot of controversy regarding false claims about language speed some time ago, and lied to it's users, you can find it.
Again, whether you believe that or not is irrelevant as it is for me, because V syntax turned me away from it, and again, don't always trust other's opinions.
Not even mine, I'm autistic C programmer who doesn't really share or sell his programs... (:
>>
>>92217643

>>92217643

>>92217643
>>
File: rainer-h-anomalocaris003.jpg (286 KB, 1920x1200)
286 KB
286 KB JPG
>>92206901
Yummy.



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