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




File: mpv-shot0022.png (326 KB, 482x518)
326 KB
326 KB PNG
What are you working on, /g/?
old: >>87448905
>>
>>87464813
Haskell.
>>
https://refactoring.guru/refactoring/smells

This is quite interesting btw. Love me code smells, simple as.
>>
File: durrrr.png (22 KB, 235x266)
22 KB
22 KB PNG
>>87464828
It's all so tiresome.
>>
>>87464841
>muh poor lil blyat vatniks dindu nothin' was all big bad HATO warmongering as usual!

kek
>>
>>87464813
>monkey programmer
>write 0 to 10 LOC/sprint
>if no dev work then I help QA
>They offered free Udemy licences
What should I learn bros? I have way to much free time.
>>
>>87464880
depends if you want to learn to learn, or learn to be a better wagie to upgrade jobs
>>
>>87464895
>depends if you want to learn to learn, or learn to be a better wagie to upgrade jobs
Definetly to upgrade jobs.
>>
File: 1611168225323.jpg (49 KB, 400x400)
49 KB
49 KB JPG
This may be a stupid question but I'll ask anyway. Say I'm writing a captcha system, client gets sent a JWT corresponding to a captcha, and a captcha image. The client must return the JWT and the solution to the captcha.
The server decrypts the token and compares it to the solution, if it matches, whatever operation the user tried to do is accepted.
Does this make sense? Currently I only ever used JWT to authenticate user identities.
Of course the JWT will have an expiration date so a crafty user couldn't just keep resending the same token/solution in whatever spam they're trying to do.
>>
>>87464968
I've never written a captcha system and have no idea if that's how they usually work but that sounds logical to me. The expiration would be pretty quick (30 seconds or so), and you could include it unencrypted (but signed so the user can't change it) in the token such that the client side UI piece that shows the captcha could inform the user if it had expired so they could click a button to fetch another one.
>>
File: 1617915751445.jpg (7 KB, 215x235)
7 KB
7 KB JPG
>>87465160
Thanks, what's the quickest/easiest way to encrypt the solution? I did a quick search and someone said to use JWE but that would be more autism I have to go and learn how to use.
Could I just hash the stupid thing like I do with user passwords?
>>
>>87465325
Well hashing isn't encrypting it's hashing, you can't get back the original data (in this case the solution to the captcha) so that's not gonna work. If you're using JWTs whatever library you're using surely has functions to encrypt/decrypt them right? That's one of the main features.
>>
kevlin henney is my spirit animal
>>
>>87464813
Well, I haven't done Java since college and I need to come back to it, what's the recommended jdk?
>>
>>87465325
just use a symmetric encryption algorithm. create a private key for the server, encrypt the token that acts as a verifier, send the ciphertext and the captcha image, then when you get a response decrypt the token cipher and compare.
also, jwe is just a standard for structuring an encrypted token that you're supposed to follow, it isn't encryption itself.
>>
>>87464813
Trying to figure out why the hell LLVM's greedy register allocator hates me and all my kin.
>>
File: simpleas.jpg (77 KB, 500x666)
77 KB
77 KB JPG
Csharters, why do we need delegates when using methods as parameters? Why not just .... IDK .......................................... use a method as a parameter and be done with it?
>>
ocaml syntax is weird. especially oop part and semicolons in random places
>>
>>87466547
it makes more sense when you realized it was made by people whose idea of a sane natural language is french
>>
>>87466502
A "delegate" is just the C shart name for a function type. It's a shitty naming choice for sure.
>>
>>87466598
>people
>>
File: 1619547295914.jpg (71 KB, 872x872)
71 KB
71 KB JPG
>>87465606
This was a lot harder to figure out/implement than your post implied. I know next to nothing about encryption.
>>
is there something like Rust but with GC instead of borrow checker?
>>
>>87466713
Not a programming language for trannies no
>>
Want to make a manga viewer/downloader because most of them are ugly but i'm a complete newbie in dev. I hesitate between C++ or Python to make it. Which language should I learn for that ?
>>
>Anon your shitty program keeps throwing this “Can’t get version number from connected device” exception, fix it
>spend half a day working on it. Can’t reproduce it
>go to tester
>”the error happens when the device isn’t plugged in”
I hate testers
>>
>>87467089
Python.
>>
any strongly typed interpreted languages?
>>
>>87467237
Python.
>>
explain this retardation to me, C++17
void asd(size_t number)
{
}

void asd(const char* letters)
{
}

int main(int argc, char* argv[])
{
asd(1); // works
asd(0); // error: ambiguous!

return 0;
}

when I add another overload, void asd(int) then it works
>>
>>87467597
That's a legacy of the braindead C design, 0 being treated as a valid pointer to anything. They have added nullptr, but there's not removing NULL from the language now, so you have to suffer. That's why C is considered weakly typed, >>87467263.
>>
>>87467624
thats unfortunate, thanks
>>
File: 3464578568.png (6 KB, 625x143)
6 KB
6 KB PNG
I want the enemies in my game to both inherit from the NPC class and be containers so you can loot their corpses.
I do this by implementing an "IContainer" interface.

What if I just make a "Container" class which is also an IContainer, make a private "Container" object inside the "Enemy" class, and then just relay all the calls for the IContainer interface to the container object? That way i wouldn't have to copy-paste changed code every time i want to change something about the way containers work.
Is there a name for doing this?
>>
>>87467645
As a workaround, you can write 0ull to specify the type of the literal.
>>
>>87467679
It's called composition.
And yes, you should make a separate class for NPC inventory. I don't see why Container has a GetInventory method though. Shouldn't it be the inventory itself?
>>
>>87467765
Thanks! Also:
This was just an example. In my actual code, containers own inventories and tell the inventory UI to access their inventory when interacted with.
>>
>

Suppose you wanted to fix a bug in your code. It’s tempting to not exit the toplevel, edit the file, and re-issue the #use directive into the same toplevel session. Resist that temptation. The “stale code” that was loaded from an earlier #use directive in the same session can cause surprising things to happen—surprising when you’re first learning the language, anyway. So always exit the toplevel before re-using a file.

why would this matter after 2022 years from death of Christ? is it just legacy compatibility?
>>
>>87467969
> 2022 - 33 = 2022
Anon...
>>
>>87467597
When you write just 0 you are making an int, which can be cast to either a size_t or a pointer with the same priority.
>>
>>87467597
>>87467624
>>87467645
>>87467725
This problem is really fucking gay. I wish they would add a "literal_zero_t" similar to nullptr_t so that you could use that to disambiguate overloads when the 0 literal is passed. I guess this could possibly break code that relies on decltype(0) being int, but such code is likely very rare.
>>
>>87468129
No, you're wrong. An int isn't cast to size_t or pointer with the same priority, it would always be cast to size_t. Notice how the problem doesn't happen in >>87467597's example for 1. It's specifically the literal 0 (and only the literal 0) that gets this special retarded treatment. It's effectively treated as if literal 0 is a different type than other int literals with different implicit conversion rules, but decltype and so forth still report its type as int. Hence why I think if we have to keep this retardation they should at least explicitly make it a different type >>87468150.
>>
>>87468170
I mentioned 0 in my post.
>>
Which is less shit?
namespace AA
{
struct Penis
{
double length;
};
}

struct AAPenis
{
double length;
};

int main() {
AA::Penis peen;
peen.length = 1.0;

AAPenis peen2;
peen2.length = 2.0;

return 0;
}
>>
>>87466713
If you don't mind a completely barren ecosystem, check out Pony
https://www.ponylang.io/discover/#what-is-pony
And give this section a read/skim
https://tutorial.ponylang.io/reference-capabilities/reference-capabilities.html
>>
>modern book on C
>author has impressive jobs
>technical advisor has impressive jobs
>chapter 2
>blatantly wrong explanation of modulo operator behaviour
>blatantly wrong demonstration of increment operator behaviour
>logical elision and ambiguity on every other page
>try another book
>exact same shit
This entire industry is a fucking joke
>>
>>87468207
Yeah, my gripe was just that you said "an int, which can be cast to either a size_t or a pointer with the same priority", which kind of implies that behavior applies to all ints but it's only the literal zero.
>>
>>87467089
Use manga-py as a guide.
>>
>>87468290
Show pics.
>>
>>87464813
can someone help me choose. I wanna learn kotlin to build apps on my phone but i hear python is easy to learn and has something like that called kivy. what is best for me to learn
>>
>>87468270
depends on the amount of classes, if you want to group together a million different genitals then Id prefer the namespace, if its a one off class, then the second one
>>
>>87468796
kotlin is a modern language and not hard to learn, your apps will also be native, so you will not be vendor locked in to a literal who framework.
use kotlin + jetpack compose
>>
>>87468796
If you want to make phone apps then do kotlin. You can always pick up python later.
>>
>>87466713
C++/CLI?
>>
>>87467597
asd(int{0})
>>
>>87469398
thats works, but I wanted the interface as convenient as possible, so I changed the const char* to a std:: string instead
>>
>>87466713
nothing usable. did you get filtered? this is usually a wish of people who can't understand the BC.
>>
>>87464813

>
block_on( /* ... */).await


Just fucking end it lmao
>>
hmm I haven't finished the V2 of my current project, but is it worth starting a new project now or waiting?
>>
>>87466713
depends on what appeals to you about Rust.
here's Go, OCaml, D, and Nim.
Go: popular, well documented, battle tested, offensively woke but not as bad these days
OCaml: efficient FP with ML influences, safest option
D, Nim: two flavors of more-ergonomic C++ competitor. Pick whichever one appeals to you more.
once you actually learn Rust, what will actually persistently bother you about it is not the borrow checker but the pervasive developer-costs-up-front attitude. All of the above options are more pay-as-you. If that is somehow what appeals to you about Rust, ... Java, maybe? GC itself is an opposing idea.
>>
What's your go-to standalone text editor to use for programming these days?

I'm still using sublime text here.
>>
>>87469735
VS Code + a bunch of addons.
>>
>>87469735
neovim, if you don't need a quasi-IDE, Kate.
>>
>>87469735
vscode is by far the best.
>>
>>87469745
Which addons?
>>
What desktop application should I program? I don’t want to do fucking to-do list or clock. Doesn’t matter if it exists or not, it just has to be functional, not just restaurant menu program or something
>>
>>87469799
> desktop application

nigga nobody does these anymore besides games and ides, and for a good reason
>>
>>87469799
Tinder, but for men seeking trans(male to female)
>>
>>87469799
surprisingly, Linux still doesn't have a proper alternative to Everything Search, still
https://www.voidtools.com/
>>
>>87469799
I think you should make a todo-list or a clock, or failing that a restaurant menu program.
>>
>>87469799
erect penis you can jerk off with your mouse until it cums and goes away.
>>
>>87469810
>for a good reason
lol, no
Just idiots falling for the webdev meme
>>
>>87469735
gnu emacs
>>
>>87469799
4chan image downloader
>>
>>87469782
For the languages/tools you're using.
>>
>>87469725
none of what you posted is like rust at all.

>once you actually learn Rust, what will actually persistently bother you about it is not the borrow checker but the pervasive developer-costs-up-front attitude.
this is the biggest benefit of rust and doesn't bother me at all
>>
>>87469844
Which nigggaaaaaaaaaaaaa namessss
>>
>>87469876
Which languages you are going to program in?
>>
>>87469857
>>depends on what appeals to you about Rust.
read, brainlet.
What appeals to ME about Rust is the ways that it's like all of those languages.
>>
>>87469897
Why are you asking me? I’m asking which do you use.
>>
>>87469810
You may be right, I guess web applications are more convenient. But I have to host that shit and person that uses program doesn’t even own it and can’t get access without internet
>>87469827
>>87469830
nigga
>>87469841
Why would anyone need program for that if you can choose exact picture you want and download it manually
>>
>>87469938
I use rust-analyzer for Rust and Pylance for Python.
>>
>>87469994
Why did you ignore mine?
>>
>>87469825
What’s the difference between built in search and that utility
>>
>>87470021
trans one?
>>
>>87469994
Because then you can download whole threads/boards at once
>>
>>87469735
VIM
>>
>>87470059
Yea
>>
>>87470067
it’s just waste of space my nigga
>>
>>87469825
$ find / -name NAME 
>>
>>87470085
Takes one to know one
>>
>>87470082
They can just use tinder/grindr and I hate troons and dating apps in general
>>
>>87470107
it uses caching
does locate have a nice frontend like it?
>>
>>87470116
Smh
>>
>>87470122
Why do you need a front-end for?
>>
>>87470183
i like CLI, but i don't think it should be used for everything
>>
>>87470192
There's this, haven't tried it to see if it's as good as voidtools everything but I hear it's similar.
https://cboxdoerfer.github.io/fsearch/
>>
>>87470192
No, it was a genuine question. I was planning to make one but I can't think of a good reason to add a GUI.
>>
>>87470203
oh right, i'll have to try that again.
>>87470248
file previews are nice, especially for videos.
quickly adding/removing folders and other settings.
not having to deal with yet another config file
>>
I need a printf's wizard's help
I want to print a number with this format
%02x

but at the same time I want it to have this "whitespace padding"
%-12s

Can it be even possible ?
Basically I'm trying to port into C one of my perl script which pretty print some assembly, and this is the perl line I want to translate (with additional stuff removed)
printf "%04x   %-12s\n",
$count,
sprintf("%02x", $hex);
>>
File: red.gb disassemly.png (90 KB, 1366x768)
90 KB
90 KB PNG
>>87470365
This is the output btw
>>
>>87470365
%-12.02x
Perl's printf can do that too.
>>
>>87470433
your output includes multiple numbers. you're going to want to have a separate sprintf
>>
>>87470041
Not sure how fast Linux search is but Windows search is abysmal (nearly useless) and Everything is basically instant (after indexing).
>>
>>87470444
Thanks anon. The dot was the problem.
I just saw that this was only 1 case out of 4. The others need to concatenate and join several formated hex, and then do printf %-12s, so I'll still need sprintf, but it still nice.
>>
>>87470508
Fancy indexed desktop search stuff is universally terrible. It always takes ages to index, still takes ages to find anything,. then in the end I can never find what I want.

Your much better off just organizing shit in the first place.
>>
>>87470456
Yes I do.
It's an ugly piece of code.
Here's an extract. That's the worst case
                printf "%04x   %-12s%s\n",
$count,
# join(" ", map { sprintf "%02x", $_ } $hex, $hex[0], $hex[1]),
join(" ", map { sprintf "%02x", $_ } $hex, $hex[1], $hex[0]), # because of endianness
join " ", join("", $color_instr, $_->{mnemonic}, RESET),
join ", ",
map {
if (exists $_->{bytes}) {
if ($_->{bytes} == 1) {
$_{immediate}
? join("", $color_arg, sprintf("%02x", pop @hex), RESET)
: join("", $color_arg, sprintf("(%02x)", pop @hex), RESET)
}
elsif ($_->{bytes} == 2) {
$_{immediate}
? join("", $color_arg, sprintf("%02x%02x", pop @hex, pop @hex), RESET)
: join("", $color_arg, sprintf("(%02x%02x)", pop @hex, pop @hex), RESET)
}
}
else {
$_->{immediate} ? $_->{name} : "($_->{name})"
}
}
$_->{operands}->@*;

I can post the code if your interested in disassembling gameboy binary
>>
>>87470613
Everything takes about 20 seconds to index both my drives and like 1/30th of a second to search.
>>
Swank server but for C.
>>
Are numbers and strings isomorphic? Since you can write every number or a symbolic representation of every number does that mean that numbers are injective to strings? Given a set of all characters in existence and a codified encoding of those characters to numbers would that make numbers isomorphic to strings? Does the set of all characters as encodings of numbers contain the set of characters traditionally used to encode base-n numbers and is each base-(n-1) encoding a subset of the base-n encoding? Are there any numbers that cannot be unambiguously discerned from each other given some symbolic representation?
>>
new retarded beginner program, what do you think
int myisdigit(char inputchar){
if ( inputchar <= '9' && inputchar >= '0')
return 1;
return 0;
}
int getoct(char* input, int* output){
int i=1;
*output=0;
if (*input != '\\'){
return 1;
}
while (*++input != '\0') {
if ( myisdigit(*input) ){
*output= *output * 8 + (*input - '0');
}else{
return 1;
}
}
}
int main (int argc, char* argv[]){
while( --argc >0){
int output=0;
getoct( *++argv, &output);
printf("%d\n", output);
}
}
>>
>>87470866
I think you're looking for countability proofs? https://en.wikipedia.org/wiki/Countable_set
The set of finite strings over countable alphabets is countable.
>>
>>87470909
>myisdigit
What's wrong with library isdigit? Unless you meant to check for numbers 0-7.
Your getoct doesn't have return after while loop, so bad things will happen if you hit '\0' normally.
>>
>>87470613
That's some strong ignorance you've got there
>>
>>87470947
I think it is, thanks. I wonder if one set of encoding of strings to numbers is countable, if that means that that set has a countable number of countable subsets of itself in different orders.
>>
>>87470866
>Are there any numbers that cannot be unambiguously discerned from each other given some symbolic representation?
Yes, the computable reals - real numbers for which algorithms exist to evaluate them to some finite precision. Testing for equality is undecidable, because no matter how precise you go, even if all the bits computed so far are the same, it's possible that the next bits will be different.
>>
How hard is it to program a visual novel game with pictures and maybe animation? Been thinking about make a porn visual novel game to make money on Patreon.
>>
>>87471181
renpy
>>
>>87471158
Oh very interesting, I had no idea.
>>
File: file.png (28 KB, 730x454)
28 KB
28 KB PNG
Why do people say Zig is safe again?
>>
>>87471181
Depends on how complex you want your engine to be. Something top-end, like rugp, would require you to use a decent sound library and write it yourself, say in SDL. If you want to add advanced visual effects, you'd need to write a renderer, otherwise SDL2 has a simple 2d renderer available.
Or, if you want to keep it as simple as possible, I heard Ren'Py is trivial.
>>
Tactics plugin for ghc 9.2.3 never ever CONFIRMED
https://github.com/haskell/haskell-language-server/issues/2971#issuecomment-1164039097
(i told u so)
>>
>>87471322
i told u so
>>87387777
>>
How silly would it be to make an existing class a template so I can instantiate it with a specific error logging type?

Would that really be better or worse than passing it in through the constructor?
>>
File: 2bjtq9-3625408808.jpg (131 KB, 972x972)
131 KB
131 KB JPG
I feel like you guys are going to hate me for this.

>using game engine that runs scripts every frame
>if I uncap the framerate, these scripts will run HUNDREDS of times per second and game logic will vary depending on framerate.
>Everybody says I should just lock the framerate to 60, that there's no way to decouple logic from framerate.

I came up with this idea.

if timerVariable >= 0.0166: #(1 divided by 60 = 0.0166)
#do thing!
timerVariable = 0.0


It works. it makes the scripts only do something 60 times per second. I did a lot of searching on this topic and nobody else came up with this solution. It doesn't seem right, I feel like I should be doing this differently, but it's all I can do.
>>
>>87471237
nobody says that. It's just modern C, or C without the preprocessor and all that implies, and some other ideas that zigguy likes.
C isn't safe.
>>
>>87471575
you should be injecting dependencies into your classes, don't make a template.
>>
>>87471587
everybody's retarded. good job on doubting that, at least.
>>
>>87471591
people constantly say zig is as safe or safer than rust. even kelley even wrote a blog post saying unsafe zig is safer than unsafe rust which was nonsense.
>>
>>87471617
imagine if you put as much effort into actually making things, as you do attaching yourself to languages based on bullet points you barely understand.
>>
>>87471587
wow
that looks so cursed
...but I guess thats normal
>>
>>87471322
Sometimes it's easiest to start from scratch. When things get too big they get hard to change.
>>
>>87471617
>nonsense
it's going to mean the precise things the article says it means, which is probably just that debug builds catch a particular class of error that similar rust code doesn't.
but this:
>constantly say zig is as safe or safer than rust
is indeed nonsense and those people are shilling themselves blind.
>>
>>87471587
If you want to cap the fps you need to do it another way. Your solution will make script execution less but the scripts will just run even more times doing nops instead, so it isn't any easier on the CPU load.
>>
>>87471660
(and things are often too big to fix easily in Haskell)
>>
>>87471637
i don't attach myself to languages and i make open source software in my spare time. i'd like for more languages and software to be safe by default and i'm interested in language developments. i don't like when people make things up about safety that turn out to be counter to reality.
>>
Has anyone used OpenCV before? I don't know anything about Computer Vision but need to use it for a project.
>>
>>87471686
>i'd like for more languages and software to be safe by default
no you don't, because you didn't bother with languages like Ada, and only cared about safety when languages like R*st started telling you to care.
>>
>>87471596
What's the downside to making it a template instead though?
>>
>>87471681
I can force people to use V-Sync and then they'll be pleasantly surprised that the game works exactly the same whether they're playing it at 60fps or 144fps and there won't be any wasted cpu cycles
>>
>>87471703
i used ada for a month and it was terrible, also shit ecosystem
>>
>>87471735
Yeah, but there should be a way to have the script execution have a fixed delay before execution as well, regardless of VSync. In SDL you can put the delay into the the event handling loop.
>>
>>87471753
ah, so you got filtered
rough
>>
>>87471724
you wouldn't have to code a template, you can program the class to use a common logging interface instead of tailoring each class with your template, you could easily change logging types later if you want without having to change your class. Feel free to make it templated if you want but having one class that has an injected logger using a common interface is far simpler to create and maintain.
>>
>>87471735
Also you should support up to 144Hz framerate cuz those monitors are out now and they are smooth no cap fr fr.
>>
>>87471371
https://desuarchive.org/g/thread/85499197/#85505727
sister???
>>
>>87471808
I use a 144hz monitor myself. that's why I want to support it
>>
>>87471827
my reply is eternal. i didn't bother replying to it previously because it was the obvious answer
>>
>>87471777
hmm well my error logging needs are incredible simple at the moment, literally just a function pointer (std::function)

but if I template it, I can use it with something that has a different signature that the types I'm passing in would be convertible to.

like say I have a logging fn with the signature
void DebugLogMessage(const std::string msg, const int level = 0) { }


and I call it in the class with:
DebugLogMessage("Error string");


I could change the log fn template to match and it would work fine

I suppose it doesn't matter much though.
>>
>>87471859
how can you reply to a statement with the same statement and claim credit
>>
>>87471880
Couldn't you make a logging interface that implements DebugLogMessage( ::string) and just use that?
>>
>>87471006
>Unless you meant to check for numbers 0-7.
that was the goal but automatically just jumped to 0-9
>>
>>87471587
https://gafferongames.com/post/fix_your_timestep/
https://gameprogrammingpatterns.com/game-loop.html
>>
>>87471587
well I don't really know, but you should probably have a single timer that runs time dependent game logic from, it could transmit a delta change in time

but that would mean your game would not behave as expected, because when your frame rate drops to like 5fps people still expect things to occur at the speed their machine is able to process them, but instead tons of things would be happening but their "view" into them would be capped at like 5fps

most games do not work like that
>>
>>87471587
tl;dr for >>87472153, what you're doing is a start, but it's more robust if you do:
while accumulator >= interval:
runScripts();
accumulator -= interval;
accumulator += deltaTime;

Assuming you want the average logic rate to be the same even if the frame rate is BELOW the target.
>>
>>87464813
Today, I'm going to burn through a few python beginner books.

I think I know what I want to do for my still simple situations, but I just don't know the syntax well enough to implement it consistently.
>>
Guys, I got a stupid questions but how do I move through a 2D array in C while assigning values in it without doing something likes this thing below ?
for(counter = 0; counter <= MAX_LINE; ++counter){
while( x <= MAX_LINE ){
arrword[x] = getchar();
++x
}
while ( y <= MAX_LINE){
arrword[0][y] = getchar();
++y
}
if( x == MAX_LINE && y == MAX_LINE){
x = 1;
y = 0;

}
}

I caught one while writing that it seems stupid.
>>
https://youtu.be/5EGw4_NKZlY?t=78

hmm
deducing "this"
>>
>>87472505
do a nested for loop
for(int x = 0; x < x_limit; x++)
for(int y = 0; y < y_limit; y++)
arr[x][y] = ...
>>
The monkey has appeared.
How do I remove trailing values from array, in JS? I came up with
const a = [0, 1, 2, 3, 4, 4, 4, 4, 4];
for (b = a.slice(), trailing = b[b.length - 1]; trailing == b[b.length - 1]; b.pop());
console.log(b);
>>
>>87472505
>++x
>not ++x;
>>
>>87472563
>C++ kills this vs self discussions
>>
>>87472563
C doesn't have this problem.
>>
>>87472563
imagine waiting for some fag cceleb to make a video on something before knowing about it
>>
>>87472620
C also doesn't have a fucking threading library nor does it have a proper time library, or random number gen, or the "const" keyword.
>>
>>87472624
Do you think this is a worthwhile argument? Careful you don't get another ban for shitposting/flameing
>>
>>87472650
>No you can't stop me advertising my videos
Not even clicking on it and I know there is literally nothing valuable in it. Deducing this is literally already in a released MSVC version that shows how long ago you should have known about it. Fuck these people who feel the need to disseminate some modified worse version of the original information with some stupid fucking accompanying blog post for views, behaviour like this needs to be mocked so nature can root it out
>>
>>87472677
>almost a month ago on /dpt/
https://desuarchive.org/g/thread/87111660/#87113509
tldr read the C++ mailing lists dont waste your time with these gay "digestible videos"
>>
>>87472645
>fucking threading library
>proper time library
>random number gen
Exercises left to the reader.

>or the "const" keyword.
Don't need it.
>>
>>87464813
I was going to continue on my SCADA system but then I had to use an industry standard application for process simulation and it's UI was so horrible I don't feel like programming today.
>>
File: 1655094729868.jpg (11 KB, 213x213)
11 KB
11 KB JPG
>>87472650
Oh no janny, please, please, don't ban me. I'm sorry! I wont ever shit on a youtuber ever again!
>>
>>87472730
What platform?
>>
>>87472740
>remember nobeta exists
>look it up
>still in early access
the fuck?
>>
>>87472677
>>No you can't stop me advertising my videos

Do you have some kind of autism? Someone in here accuses me of shilling "my channel" every time I post a video regarding something interesting and programming related.

So what the fuck is your problem? Some kind of complex about not getting enough attention? I sure as fuck don't have a programming channel, nor do I shill it here ever.
>>
>>87472793
>early access
pretty sure thats what nobeta fags want
>>
I'm kinda new learning python. using bs4 I made a small webscraper that gets the most current price of a stock. but what I've been able to get down to was <div class="YMlKec">$694.95</div>
how do I extract just the price itself?
>>
>>87472677
No one gives a fuck what your opinion is.
>>
>>87472820
:(
>>
File: 192347342563864.png (285 KB, 621x610)
285 KB
285 KB PNG
>>87472807
>Someone in here accuses me of shilling "my channel" every time I post a video
Maybe you should stop doing that?
>>
Make a new 4chan. Replace 4chan with a better one.

The rape ads and subversive fake moderators are EVIL!
>>
>>87472836
Maybe you should suck my ass and quit shitposting about it. It's a fucking youtube video, either watch it or don't. but instead you just decide to shit up the fucking thread bitching about it for no goddamn reason
>>
>>87472860
>Can't tell the difference between shitposting and gatekeeping
>>
>>87472811
https://beautiful-soup-4.readthedocs.io/en/latest/index.html#string
>>
File: performance.png (587 KB, 1061x792)
587 KB
587 KB PNG
C# uber alles ?

How much of the existing software base of the world could be rewritten in C# and not suffer greatly from it? How much of the Windows OS?
>>
>>87472807
Upload your videos to bitchute or odysee instead and I will give your channel respect.
>>
>>87472912
>j-j-just re-upload them to my preferred streaming siitttee!

How about no. Maybe you should learn to use a fucking configurable DNS to block ads if you're so worried about giving Youtube money.
>>
File: 1644219400344.png (471 KB, 466x470)
471 KB
471 KB PNG
>>87472912
But then he won't get money from advertising his videos anon
>>
>>87472932
I think odysee is sort of viable for streamer gibs these days, as long as you are getting money from viewer donations.
>>
>>87472810
this was a joke btw please laugh
>>
>>87472900
oh shit, tnx and srry for such an easy thing. maybe I should start learning some html so I can identify it as a string easier.
>>
>>87472910
I hate everything about that slide - the conflation of programmer vs manager vs user desires, the stupid question-

>If programmers are willing to sacrifice performance for program correctness, why study performance?

Jesus, who thinks like that?
>>
>>87472910
For starters, everything that runs on Java
Every web service backend
Everything written in python
>>
>>87472505
So I've used nested for loops, it complies all nice but it gives me a segmentation fault at the part where it's supposed to have the cutter function print it's thing, any idea why ? Using GCC.
#include <stdio.h>
#define MAX_LINE 1000
#define CUT_OFF 80

void cutter(char arrword[MAX_LINE][MAX_LINE]){
int x, y = 0;

for( x = 0; x <= CUT_OFF; ++x){
for ( y = 0; y <= CUT_OFF; ++y){
arrword[x][y] = '\0';
}
}

for( x = 0; x <= MAX_LINE; ++x){
for( y = 0; y <= MAX_LINE; ++y){
while(arrword[x][y] != '\0')
printf("%c", arrword[x][y]);
}
}

}


int main(void){

char arrword[MAX_LINE][MAX_LINE] = {0};
int x = 0, y = 0;

while (arrword[x][y] != EOF && x <= MAX_LINE && y <= MAX_LINE){
for( x = 0; x <= MAX_LINE; ++x){
for( y = 0; y <= MAX_LINE; ++y){
arrword[x][y] = getchar();
}
}
}
void cutter();

}
>>
>>87473094
you want to call cutter(arrword); not declare cutter
>>
For loops are fucking fake
>>
>>87473168
Looping for who?
>>
>>87473094
Are you sure you understand what the while keyword does?
>>
I DID IT

It took like half a year of learning, searching, refining my resume, etc.

But I actually have a wonderful job now.
>>
best resource to learn Java Spring?
>>
>>87473173
It would be extremely redundant
>>
File: 1655329143742.gif (482 KB, 220x165)
482 KB
482 KB GIF
>>87473184
>>
>>87473221
You're a predictable jump
>>
File: suitcase.jpg (294 KB, 720x683)
294 KB
294 KB JPG
>>87473226
>mfw
>>
>>87473229
For you
>>
>>87473184
elaborate
>>
File: welp.jpg (224 KB, 1573x944)
224 KB
224 KB JPG
>>87473094
With anons tips it's doing something but there should not be a fuckton of garbage characters
>>
>>87473513
are you feeding it less than 1'000'000 characters? if yes those are probably all EOF converted to char.
>>
>>87473094
>x <= MAX_LINE
>y <= MAX_LINE
Buffer overrun. The last valid index is MAX_LINE - 1. You are accessing memory out of bounds.

>while(arrword[x][y] != '\0')
>printf("%c", arrword[x][y]);
What is the purpose of this non-terminating loop?

Honestly, I am not sure what your program is supposed to be doing. Are you trying to get lines of user input into an array of strings? Do you understand when the loop condition is checked? Because some of your loops don't quite make sense.
>>
I have a weird problem with my python script that i dont even know how to debug.
The script simulates 18 years of transactions and writes them into an sql database. It works fine on a shorter timeframe, but when trying to run the entire 18 years the script reaches a random point and just hangs.
There is no error, i'm not out of memory, and everything up to that point is executed correctly. It just hangs on a random date, forever(i ran it while i went to work, so there was plenty of time)
Also, the failure point is random each time, on my first run it was 6 years in, and on my second run it was on 13.
Any idea what might be causing this?
>>
>>87473636
Launch a debugger and find out. My bet is it's probably some kind of "rare" deadlock w.r.t. the SQL transactions.
>>
What's going on in C when I chain statements with commas in a single line, versus ending each with a semicolon like usual?
>>
>>87473799
you can't chain statements with commas, only expressions. It's called the comma operator.
>>
>>87473636
Find a pattern as to when it fails. Check the logs. You didn't mention whether this is a local database or remote, but check to see what happens with your network.

> i'm not out of memory,
What about handles? You didn't share code, but if you are creating a bunch of handles and new queries, its possible that you could have run out of handles if they aren't being managed correctly. I should also point out that, depending on the transaction you are simulating, if one causes another to wait under certain conditions, you could gradually run out of handles over time, even if they are being correctly managed.
>>
>>87473833
Aaaaahhhhhh thanks anon
C is neat
>>
File: this.jpg (16 KB, 854x180)
16 KB
16 KB JPG
>>87473577
>What is the purpose of this non-terminating loop?
I replaced it since I figured it would not work the way I thought it would but I basically wanted it to print all the characters that are not null.

>Honestly, I am not sure what your program is supposed to be doing. Are you trying to get lines of user input into an array of strings? Do you understand when the loop condition is checked? Because some of your loops don't quite make sense.
I am trying to do this exercise in the KR book.
>>
>>87473920
did you do the exercises before that one?
>>
>>87473955
Yeah, I did
>>
Is multiple inheritance ever a good thing? I was taught early to avoid it.
>>
>>87474012
no, inheritance in general is a bad thing
>>
>>87474012
It's a good tool if you need to copy multiple implementations into a class (usually comes with CRTP).
>>
>>87473707
I'm a brainlet who debugs with print statements, but i'll try running it with a debugger tomorrow morning to see if it can tell me anything

>>87473857
I'd share the code, but i need to remove a bunch of things that traces back to my work first, so ill post it tomorrow if i dont figure it out.
It was sort of a learning project, to learn SQL on a practical example instead of on piss easy exercises, so at this point i dont even know what handles are, so they are definitely not being managed. I'll read up on handles, thanks for the tip.
>>
>>87474035
I'll have to try it out sometime.

>>87474034
Agreed, but what is the best replacement?
>>
>>87464813
Dropped Rust, I'll go back to C++ and try to get a job.
>>
>>87474407
welcome back lad.
>>
>>87474074
>Agreed, but what is the best replacement?
composition with traits/concepts/interfaces
>>
>>87473920
Here is one possible solution. The concept is to store characters up to the 80 character limit (because we don't know whether or not the line is longer or shorter than that). If we have characters past the 80 char limit, print all stored characters, then from that point on just print all characters up until the newline.

#include <stdio.h>

#define LINE_LENGTH_THRESHOLD 80


int main(int argc, char *argv[])
{
int ch;
int counter = 0;
char line[LINE_LENGTH_THRESHOLD + 1] = { 0 };

while((ch = getchar()) != EOF)
{
if(counter < LINE_LENGTH_THRESHOLD)
{
// store characters because we don't know the length of the line yet
line[counter] = ch;
}
else if(counter == LINE_LENGTH_THRESHOLD)
{
// line is long enough to print, so print stored characters and current character
line[counter] = '\0';
printf("%s%c", line, ch);
}
else
{
// past threshold, so just keep outputting the entered character or EOF or newline
putchar(ch);
}

// if end of line, reset counter, otherwise increment it
if(ch == '\n')
counter = 0;
else
counter++;
}

return 0;
}


One could use fgets and make it considerably shorter.
>>
>>87474407
Why? Rust is just so much better. And you don't need bloatware like cmake-init to make a fucking project skeleton.
>>
>>87474460
absolutely seething
>>
>>87474469
Hello cmake-init fag.
Cargo will always be better than your shitty Python bloatware.
>>
>>87474491
i don't even use C shit anymore, retard.
not everyone who hates your meme lang is a c tard
>>
>>87474460
>and try to get a job.
That why, C++ is flawed but it works.
>>
>>87468290

okay, but did they write good code
>>
>>87474436
Thanks anon, this makes sense, I was overdoing it.
>>
>>87464813
I’m reading eloquent JavaScript in the bathtub
>>
File: 1633363833204.png (817 KB, 1651x1392)
817 KB
817 KB PNG
Writing in Python; is it possible to write something that takes a list of classes and returns an object that has all the methods of the given list of classes (as if it was an instance of a class that inherited from every class in the given list)?
>>
>>87464813
I'm learning sql using sqlbolt
can someone recommend me good textbooks, yt channels/videos or websites about database design for beginners, which/when to use specific database for a small/medium/big project?
also are there websites with good exercises to practice sql?
>>
>>87474853
I don't see why not. The dir function should be helpful to you.
>>
>>87474460
>>87474491
lol, why are you so assmad that C++ people can have it easy now?
>>
>>87474853
should be pretty simple with the three-argument version of type().
>>
>>87474913
>C++ people can have it easy now?
If C++ users actually believe they have it easy, they've clearly never even tried Rust.
You don't need third party tools to manage packages or create projects.
You don't need third party static analyzers, as the compiler does all the work for you AT COMPILE TIME.
The list goes on.
>>
>>87474913
c++ is a cult and will never "have it easy". nothing about it is easy now. nothing will change because every c++ programmer is the smartest programmer ever and will never agree with another one on how to do things like building or packaging.
>>
rustbros - if a crate exports a function which signature has a type from another crate, which the first crate does not reexport, what the fuck do I do then
>>
>>87474956
stop using a shitlang
>>
damn, fungus zealots seething real hard rn
>>
Realistically speaking, what is to stop a Rust dev from pulling a Brandon Miller (the guy that used the node package system to overwrite files on computers from Russia and Belarus)?
>>
>>87474956
That's not possible.
>>
>>87474979
frfr just let me use whatever i want, stop trying to recruit me lol
>>
>>87474991
nobody actually uses rust so it wouldn't effect anybody
>>
>>87474956
you put in a request for them to re-export their public dependencies and temporarily depend on the crate that has the type you need
>>
>>87474956
>>87474998
Oh, never mind, I misread that. You need to explicitly depend on the second crate (which doesn't really change anything, since it's already getting pulled as a transitive dependency).
>>
>>87475039
>>87475066
that sucks, it should be required for library crates to re-export the types of their public interfaces, or it should be a check on crates.io or something
>>
>>87474421
>composition with traits/concepts/interfaces
Doesn't do the same thing as inheritance
>>
>>87474608
It was definitely C
>>
>>87474950
if trillions of lines of existing codebase is "a cult" then sure
>>
Best way to change a user's password from a Python script running as root? Piping through to os.system is fine but when I tried this

f'sudo chpasswd <<<"user:{password}"'


it gave some error about unexpected redirect and didn't work. I tried some other syntax with echo and pipe but while it worked in interpreter it didn't seem to work once my script got called from cron. (And the other stuff in the script did work so I know it's not just an issue with cron loading the wrong path or something.)

For what it's worth the above syntax did seem to work when called from a bash script, but not from Python's os.system for whatever reason.
>>
>>87475208
Oh actually I didn't use sudo in the command though, the script itself was run from the root crontab. So it was

os.system(f'chpasswd <<<"user:{password}"')


I guess I should really set up some proper logging on this thing to see what the hell it's actually doing though it's a pain and I thought something this simple I should be able to solve more easily
>>
>>87464813
What's the best way to model data with some inherent order in SQL? For example if the user has a list of foos:
CREATE TABLE foos (
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
value VARCHAR NOT NULL,
bar_id integer REFERENCES bars(id)
);

The foos can be ordered however the user wishes however the inherent order and the bar_id should be a unique combination.
Do I have to just create an order column + unique index and manage everything myself? If that's the case then how do you know what value to use for order when appending new foos?
>>
>>87475174
Depends on the language.
Go will deref and implement the interfaces of any embedded structure, it's very similar to inheritance.
Rust can deref via the Deref trait, but it will not implement the traits of the dereferenced structure, so in this case, it's indeed not the same.
>>
>>87475174
never said it did
>>
I have a question for anyone, say I loaded up my Twitter in a browser, chrome or Firefox, and I wanted to write a js program that would automatically follow users and then automatically unfollow them later. How could I do that? Are there browser plugins to run JavaScript on websites? Is grease monkey one?
>>
File: :^).png (61 KB, 798x238)
61 KB
61 KB PNG
what do you think?
would it work?
>>
>>87475319
You can't replace something with something that isn't equivalent
You gain nothing by reimplementing inheritance via composition instead of just simply using inheritance
>>
>>87475327
>Are there browser plugins to run JavaScript on websites? Is grease monkey one?
Yes and yes.
>I wanted to write a js program that would automatically follow users and then automatically unfollow them later. How could I do that?
You need two things: an API to follow and unfollow users, and a storage to remember how long you've followed them for.
Follow API is provided by Twitter; you need to either reverse engineer the sent requests or just make the script press the buttons in the UI.
Storage is best done by Greasemonkey API.
>>
what's the status on rust language, is it dying or growing more popular?
>>
>>87475379
Yes, I’ve used other browser automation tools that simply record your clicks but they are often buggy so now that I am learning JavaScript maybe my first project will be a grease monkey script that follows/unfollows using the UI to click etc
>>
File: FUbiVr7VUAEYRSE.jpg (29 KB, 460x525)
29 KB
29 KB JPG
>do, literally anything, in Rust
https://doc.rust-lang.org/error-index.html#E0658

ffs
>>
How can you execute Rust code faster that by compiling it with rustc and the executing it ?
Is there a REPL ? Or can you speed up compilation by removing optimizations ?
>>
>>87475420
I think I'm beginning to realize that Rust is just too goddamn new to be able to compete with something as established as C++.

I might come back to it in a few years or something.
>>
>>87475431
7 years old
~10 is usually when langs hit maturity and enter the mainstream like C++. Meanwhile fungus still has another decade of problems to sort, that are usually pre 1.0-era
absolutely grim
>>
>>87475431
C++ is fundamentally broken, it's why D and Rust were made.
>>
>>87475431
To be fair, the better parts of C++ are also new.
I think modules are still only implemented by MSVC.
>>
>Programming Language Statistics

> JavaScript is the most widely used programming language worldwide, with 64.96% users. (Steel Kiwi)
> Python is the third most loved programming language, as 66.7% of developers who have experience in using Python love it. (Stack Overflow Insights)
> With a 11.59%% rating in May 2022, C is the second leading programming language in the TIOBE Index. (TIOBE)
> Worldwide programming language statistics show that 49.5% of hiring managers look for those who know python when recruiting developers. (Hacker Rank)
> Asia has the highest number of Java developers, where 2.5 million developers use it as their main language. (Slashdot)
> Rust is one of the most loved and sought-after programming languages globally, with 86.98% of software developers using it. (Stack Overflow Insights)
> Stack Overflow’s survey shows that over 35% of respondents have been coding for less than five years. (Stack Overflow Insights)
> 84.21% of software developers think that COBOL is the worst programming language, while 79.39% said VBA is the most dreaded framework. (Stack Overflow Insights)
>>
>>87475460
>C++ is fundamentally broken
not it isn't
>>
File: windowschantp.png (313 KB, 398x602)
313 KB
313 KB PNG
>>87475444
The fact that this code is a problem is pretty fuckin' grim desu. Win API bindings should have been the first priority. Making a type alias of the winapi ported type is apparently a beta feature, so now I have to try to handle that instead of making this code actually compile? Why would we ever do this to ourselves?

use std::process::ExitCode;
use winapi::um;

struct VirtualMap;

// https://docs.rs/winapi/latest/winapi/all.html
impl VirtualMap
{
type ScanCodeType = winapi::ctypes::c_ushort;
type VirtualKeyType = winapi::ctypes::c_uint;
type PrintableType = winapi::ctypes::c_char;

/// <summary> Utility function to map a Virtual Keycode to a char </summary>
/// <returns> printable char value or 0 on error </returns>
fn GetCharFromVK(vk:VirtualKeyType) -> PrintableType
{
let mappedVk = um::winuser::MapVirtualKeyA(vk, um::winuser::MAPVK_VK_TO_CHAR);
return mappedVk as PrintableType;
}
};

fn main() -> ExitCode
{
println!("I hate Rust.");
return ExitCode::SUCCESS;
}


>>87475460
C++ just keeps on trucking, making good software that people use every day. It's multi-paradigm friend.
>>
>>87475472
literally has 5-10 talks every year about basic things not working correctly, breaking spec, or being outright bizzare and bordering on UB-like
It's a behemoth that not even the committee can keep up with anymore
>>
>>87475519
That's loser-talk, people use C++ just fine every single day.
>>
>>87475420
>If you’re using a stable or a beta version of rustc, you won’t be able to use any unstable features. In order to do so, please switch to a nightly version of rustc (by using rustup).
Why is this a problem? Install nightly if you want to do that.

>>87475431
Instead, just wait every 3 years and hope the committee doesn't completely fuck up a standard, then wait for compilers to even implement that. So much better instead of rolling 6 week releases.
>>
>>87475472
C++'s evolution is Frankenstein. It's still a useful tool but it's hardly a pure language.
>>
>>87475471
> Rust is one of the most loved and sought-after programming languages globally, with 86.98% of software developers using it. (Stack Overflow Insights)
I don't believe it
>>
>>87475570
/g/ is detached from reality
>>
I was trying to run something in wine but it didn't work out.
Now I got some crash info.
>Module Address DebugInfo Name
>PE [address] Deferred [Name]
Etc.
Then
>Process tid prio name
>[number] (D) [full path]
>[number] 0 <==
>[number] services.exe
>[number] 0
etc

Can someone here help me understand the different things that I'm looking at? Like "deferred" or "<=="
>>
>>87475597
>>>/g/sqt
>>>/g/fglt
>>
>>87475570
It's indeed incorrect.
The survey shows that 86.98% of Rust programmers like the language, not that 86.98% of the programmers adopted Rust.
>>
>>87475514
>C++ just keeps on trucking, making good software that people use every day. It's multi-paradigm friend.
>C++
>good software
No. You can't genuinely be fucking serious, nobody actually uses C++ for making 'good software', only proprietary shitware like drivers. This is why Rust will win in the end, being a language by free software enjoyers for free software enjoyers, it has the power of the entire free software community behind it. Ever wondered why Rust is being allowed for Linux kernel drivers now, but C++ isn't? Because C++ is fundamentally a broken language full of undefined behavior and other security holes that even the most experienced boomers can't fix without overhauling the entire language every talk.
>>
>>87475609
>>
>>87475570
they probably mobilized the dilation squads to participate in that survey to dunk on the C++ nazis epic style
>>
File: file.png (20 KB, 460x351)
20 KB
20 KB PNG
>>87475624
>and other security holes
>>
>>87474891
>>87474916
Thanks, didnt even know three-argument type existed
>>
>>87475609
What's the % for C?
>>
>>87475624
being proprietary has nothing to do with being good you ideologically brainwashed moron
>>
>>87475663
considering "X enjoyer" is a meme, i'm pretty sure he's shitposting
>>
>>87475679
Not everything is a meme zoomer
>>
>>87475624
>the power of the entire free software community
did someone write this unironically
>>
>>87475708
meanwhile 50 years later and KDE still has that annoying bug where windows just stop refreshing properly
>>
do you recon I could make a marble run simulator accurate enough that the same run would have the same behavior in the real world? It's just a marble going down a track, seems constrained enough to me.
>>
>>87475735
Nope. It's not possible at all
>>
File: file.png (67 KB, 474x150)
67 KB
67 KB PNG
why does factor make forth programmers seethe so much? is it just because its higher level, and therefore actually usable outside of MPUs?
>>
>>87475735
Many have tried and failed. I wouldn't bother with it.
>>
>>87475742
>>87475781
sounds like it's easily doable. thanks guys!
>>
File: 1653577934546.jpg (163 KB, 1024x1024)
163 KB
163 KB JPG
How can i use malloc to sort a given list without needing to ask the user how many element there will be?


void selSort(int* numArr[], int len);

int main(void)
{
int sort = 0;
printf("How many elements to sort sir?\n");
scanf("%d", &sort);
int* numArr = malloc(sort * sizeof(int));

printf("Very good enter them now\n");
for (int i = 0; i < sort; i++)
scanf("%d", &numArr[i]);

selSort(numArr, sort);

for (int i = 0; i < sort; i++)
printf("%d ", numArr[i]);
}

void selSort(int* numArr[], int len)
{
int temp = 0;
if (len == 1)
return;
for (int i = 0; i < len; i++)
{
if (numArr[i] > numArr[i + 1])
{
temp = numArr[i + 1];
numArr[i + 1] = numArr[i];
numArr[i] = temp;
}
}
selSort(numArr, len - 1);
}
>>
>>87475812
Use rust.
>>
>>87475755
it's a similar thing to Clojure vs the rest of Lisp
One deviates from the norm, and the collective see it as an anti-feature.
In Factor's case, it's the dynamically typing vs untyped and the GC which Forth people feel is an insult because you lose some memory control and self-modifiability that the language/paradigm is known for.
>>
>>87475268
>however the inherent order and the bar_id should be a unique combination
So... the inherent order is part of the data value but also a key? Because if the inherent order is non-repeating, you could be using it as a primary key anyway. I'm not sure I fully understand the inherent order you are talking about anyway.

I interpreted what you are saying as this:
Let's say foo is a song on an album. Its inherent order would be the track number, and while the relevant data can be retrieved in any order, that song + track number combination is unique to an album (not guaranteed to be true IRL, but conceptually)?

Can you give an example of exactly what you mean? Because everything I can think of that has an inherent order seems like it would just be another column for the data. I think of something like log events ordered by date, that kind of order? Because you'd already have a column for that piece of data, wouldn't you?
>>
File: liked-dreaded.png (104 KB, 1165x1738)
104 KB
104 KB PNG
>>87475661
>>
>>87475898
Cniles... I think we actually lost this time...
>>
>>87475898
Fake stats
>>
>>87475609
>86.98% of 7 people liked the language
>>
>>87475898
>Swift that high up
Is Swift any good? I heard it recently got ported to Linux and Windows
>>
>>87475935
>I heard it recently got ported to Linux and Windows
Only the compiler, the tooling is still absolutely shit.
>>
>cniles always call rust users "trannies" yet cniles are the ones denying reality
curious
>>
>>87475935
literally 0 reason to use it outside of iToddler shit
>>
>>87475812
It's not a malloc question, it's a sorting algorithm question.
They are many sorting algorithms, and some of them can sort in-place, other just can't.
>>
>>87475935
i think it's better than anything else they've had to use like objective-c
>>
>>87475898
>1 gemmy
>2 gemmy
>3 gemmy
>4 gemmmy
>5 coalson
>6 coalson
>7 coalson
>8 coalson
>9 coalson
>10 gemmy
Such shitty taste stackoverflow has
>>
>>87475812
You can make a dynamic array that starts with an initial size, then automagically expands as you add more data to it.

Also, why did you name your size variable 'sort'? Not count, not length, but 'sort'? That's a name for a function that sorts. If it's a verb, it usually sounds like a function name. Good data names are typically nouns.
>>
>>87475846
but doesnt factor still have malloc and mmap?
ive always just seen factor as forth if it was for software development instead of embedded systems, but if i ever say that to a forth developer they say im wrong and the entire programming experience would be different. arent they effectively the same from the dev perspective, just in a different part of the stack (no pun intended)?
>>
>>87475958
no the reality is that rust is fucking dog shit and im tired of crabfags pretending it isnt
>>
>>87475978
ty anon i see what you mean that was a bad name to choose

how do i expand my array after i made it? do i have to make a new array with the bigger size and transfer all the data over?

i thought there's no way to guarantee that allocated blocks are contiguous?
>>
>>87475988
perhaps, the opposite is true
>>
>>87475966
I see what you mean i asked the question badly.

What i need first is to be able to make an array to store numbers based on how many the user gives.

Maybe i should just use a linked list rather than an array, because then i could even allocate and sort it as the user enters each number
>>
>>87476019
worst cope the rust community has ever churned out
do they even try anymore? back in the day shilling used to mean something
You're a disgrace to the psyop community
>>
>>87474991
theres two sides to this
>what is to stop a Rust dev from pulling a Brandon Miller
literally nothing
however, i now present a second observation:
>who would care if a Rust dev pulled a Brandon Miller
literally nobody

the reality is, nobody wants to have a bad rep. and its not only rust devs you should be worried about: what's to stop your neighbour from fabricating a harassment claim against you tomorrow? literally nothing. but then, who would want to get tied up in such a messy affair? literally nobody, except for a few schizos who inevitably alienate themselves from everyone else. communities are self-governing in many ways. they appear fragile, but actually they're quite strong.
>>
>>87475998
>do i have to make a new array with the bigger size and transfer all the data over?
Usually.

>i thought there's no way to guarantee that allocated blocks are contiguous?
See above. You might also use realloc, but you should still need to be prepared to allocate a larger chunk, then copy over. A not-uncommon strategy is to start on the small side of reasonable, then double the allocation size each time. Yes, this means repeated copyings.

>>87476042
>link list.
I suppose you could, it depends on what your goal here is. A linked list of integers is sort of silly.
>>
>>87475982
>but doesnt factor still have malloc and mmap?
yeah, you just go through the C FFI.
Factor is just slightly higher level, less geared towards tinkering, and more towards making things. it's why it has typing, so debugging is less painful. I wouldn't think it an "inferior" forth in any way but ideology/dogma wank.
>>
>>87475647
>the keyword is there so it must be rust's problem!!!
CVE-2022-31053
>Biscuit specification version 1 contains a vulnerable algorithm
>The version 2 of the specification mandates a different algorithm than gamma signatures and as such is not affected by this vulnerability.
>The Biscuit implementations in Rust, Haskell, Go, Java and Javascript all have published versions following the v2 specification.
CVE-2022-27943
>libiberty/rust-demangle.c in GNU GCC 11.2 allows stack consumption in demangle_const
CVE-2021-46195
>GCC v12.0 was discovered to contain an uncontrolled recursion via the component libiberty/rust-demangle.c
CVE-2021-45719
CVE-2021-45718
CVE-2021-45717
CVE-2021-45716
CVE-2021-45715
CVE-2021-45714
CVE-2021-45713
>literally all are due to C FFI with SQLite
now look through the null pointer dereference CVEs and see how many are related to Rust
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=null
>>
>>87474053
>I'm a brainlet who debugs with print statements, but i'll try running it with a debugger tomorrow morning to see if it can tell me anything
look into PyCharm, you don't need to paid edition - just get the community edition.
that IDE took my Python game to another level.
>>
>>87476019
no. rust is the worst language ive ever used and im not even kidding,
cargo is shit
the language is ugly
its entire purpose in existing is bullshit because its idea of safety above everything else is a midwit meme. any serious software written in rust needs a certain level of unsafety or completely giving up on maintenance.
rust is just infecting fucking everything because retards are using the fact that its new and has corporate backing as an excuse to rewrite everyhing they can think of in it so they can easily fill out a portfolio in the language that mozilla thinks is the second coming of christ.
anyone that likes rust inherently trusts mozillas opinion on how programming languages should be made, when judging by their opinions on how web bowsers and email clients go, they shouldnt turst mozilla any further than how far a crabfag can throw any of the twinks that work for mozilla, which considering how much s o y is flowing through their veins, isnt very far.
>>
>>87476103
>and see how many are related to Rust
more than 0, so you've already failed
so much for """""safety"""""""" :^)
>>
>>87476128
>rust is the worst language ive ever used and im not even kidding,
>cargo is shit
>the language is ugly
lmao
>>
>>87476129
>man blows off arm, feigns superiority to man with bruised pinky
>>
>>87476177
null ptr derefs are not "bruised pinkies"
your meme lang is just as bad as C.
cope, seethe, dial8
>>
>>87476184
>just as bad as C
so that's why most Rust CVEs are related to C FFI, while C, C++, etc. have thousands of CVEs all by themselves, right?
>>
>>87476200
you can't promise "safer" than C, and still allow the same problems it does.
Even 1 is 1 too many, you and your meme lang are scammers.
You cannot side-step out of this reality like you do others.
>>
There's nothing more soi than worrying about CVEs
>>
>>87476088
this is going to sound retarded, but isnt dynamic typing and untyped effectively the same in practice unless youre doing something retarded?
>>
>>87476078
hmm okay anon tyvm i will give it some thought
>>
>>87476214
>your language isn't perfect so it's no better than my shitty language with way more vulnerabilities!
>>
>>87476162
lmao doesnt refute the point
>>
>>87475898
>Big brain languages get hate
>Pajeet languages are loved
Everything seems fine here.
>>
>>87476237
using cargo refutes the point
>>
>>87476249
what the hell else would you use? its the rust package manager right? saying rusts package manager is bad because it uses uncompressed binaries for everything is a valid point against rust, right? how is it any different from saying the rust compiler or llvm are bad because theyre somehow slower than c++?
>>
>>87476225
>but isnt dynamic typing and untyped effectively the same in practic
No, because dynamic typing still allows many errors to be caught/detected/ or provide you with valuable information you wouldn't have with untyped.
That's why the Factor dev added them, because debugging regular Forth can be a challenge, especially when you do a lot of complex run-time code modifies.
But try Gforth if you haven't, and build your own opinion
>>
day #2 of programming in go and I like it.
it's really too bad that it was officially racist for so long, because it has a lot going for it, especially if you're comfortable with 'Worse is Better' design
>>87476240
Rust, Clojure, Elixir are pajeet languages?
>>
>>87476261
>saying rusts package manager is bad because it uses uncompressed binaries for everything is a valid point against rust, right?
no, what the fuck does that even mean
>>
>>87476282
nobody on /g/ has touched elixir, but they write it off because it's web-focused
>>
>>87476225
academically, untyped means no static typing of variables, so dynamic typesystems are "untyped"
realistically, dynamic type systems still use typing for the values.
SO has a pretty good answer related to this.
https://stackoverflow.com/a/9166519
>>
>>87476294
I write it off because it's dynamically typed.
The one thing you don't want for code with more than one file.
>>
>>87476309
elixir is a bit different, and because of BEAM, run-time errors aren't the usual trouble.
>>
>>87476271
since i dont particularly like dynamic typing, would a statically typed forth/factor-like language be worth making? or does factor not fall into as many of the same pitfalls as languages like python? i dont really have enough experience in it to form a real opinion, i just like the idea of a slightly higher level forth
>>
How do I convert a LaTeX file to PDF in Windows? I don't want to install any bloated software suites or "TeX distributions" like "MiKTeX", "proTeXt" or "TeX Live", all I want to do is download some pre-compiled binary command-line program and use it to compile my LaTeX file to PDF. Is that not possible? If not I'll stick to using HTML, I don't want to have to install bloatware just to quickly produce some documentation in PDF.
>>
File: 1653235415720.jpg (59 KB, 481x480)
59 KB
59 KB JPG
I just spent 2 hours figuring out how to make a pyramid with text symbols. It works but I only did it through trial and error and still can't wrap my head around the algorithm. Feels very brainlet
>>
new thread
>>87476416
>>87476416
>>87476416
>>
>>87476398
do you mean a triangle?
>>
>>87476365
static types don't work well with a programming language that's intended to work as a persistent mutable environment. StrongForth's been done and it's meh and even more forgotten than most Forth experiments.
>>
>>87476365
Forth/Concat langs are pretty different from regular C-style langs, so I wouldn't really think about typing as you currently know it.
And as the other anon said, getting too distant from the core paradigm almost never works, as we've seen from the few static Forths, and the entire ocean of statically/typed Lisps.
Factor made pragmatic changes with real arguments, and didn't just have something like static typing because "Static typing is always good for everything".
>>
File: TEST00852.png (369 KB, 720x480)
369 KB
369 KB PNG
I have a json file with this structure:
{
"collections": {
"tags": {
"2GvAB3TrWwJSdDeAdg4R": {
"id": "",
"aperances": 1,
"tagName": "todolist",
"__collections__": {}
}
}
}

what I want is to remove from the ""2GvAB3TrWwJSdDeAdg4R" object:
>id
>__collections__
So i can have the object like:
{
"collections": {
"tags": {
"2GvAB3TrWwJSdDeAdg4R": {
"aperances": 1,
"tagName": "todolist",
}
}
}

I kind of tried to do something in python, but I'm not sure how to do what is commented, I think that is how you should approach this, but not sure...
import json
cont =0
with open('json.json', 'r+') as f:
data = json.load(f)
for tag in data['tags']:
for data in tag:
if cont == 0 or cont == 3:
#delete from json
cont+=1

#return the new json

Thanks anons!
>>
>>87476470
>Factor made pragmatic changes
Factor's a NIH pile of shit made by an asshole and abandoned as soon as he got a job making spyware or sucking dicks. Factor just shows his particular influences, it's not the result of some long refinement process. oforth and retrofoth and the Israeli Forth I can't remember the name of did similar stuff.
>Forth/Concat langs
this is even more offensive than "C/C++"
>>
>>87476395
you need miktex
>>
>>87475624
They don't allow C++ in the OS because of
a. autism
2. shit programmers
>>
>>87473184
Spill the beans fag
>>
>>87475514
>Making a type alias of the winapi ported type is apparently a beta feature
The problem is not that you can't have type aliases, the problem is that you can't have inherent associated type aliases (i.e. type aliases in an impl so you can write VirtualMap::ScanCodeType). I'm not really sure why it's fine for traits but not inherent impls, but it's hardly an earth shattering limitation.
>>
>>87476474
use de for deleting a key/value pair of an object
del data["collections"]["tags"]["2GvAB3TrWwJSdDeAdg4R"]["id"]
del data["collections"]["tags"]["2GvAB3TrWwJSdDeAdg4R"]["__collections__"]



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.