[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 330
Thread images: 33

File: d lang.png (909KB, 1280x720px) Image search: [Google]
d lang.png
909KB, 1280x720px
What are you working on, /g/?


>>62149024
>>
>>62156754
First for fuck C
>>
>>62156776
t. pajeet
>>
>>62156754
Rust > D
>>
>>62156754
Why D is dead?
>>
>>62156784
because it was never alive.
>>
>>62156707
So there's no way to do this without using some pajeet's library?
>>
I have found something to dislike about Rust... or rather, its build system, Cargo.

Where I come from in the land of C, C++, and Makefiles, there is a notion that if you make an alteration to one source file (a .c or .cpp file), there is not necessarily a need to recompile the rest, so long as you have not deleted the intermediate .o file. In a large project of perhaps hundreds of files, this saves time on compilation for each small change.

In Rust, there's a number of different but sort of similar ways to handle compilation of multiple files. You can compile to .o and the like to fit into a C project just fine or produce a library, but this doesn't carry the type information over. Instead, modules are preferred.

Within a Rust program, you can declare that you are using code from another compilation unit either using the mod keyword or extern crate. With the latter, you supply a .rlib file to rustc and it links it in as if it was a normal .a library with built-in type information. Pretty nifty. One would think that the natural way to do things would be to use .rlib as an intermediary format for every .rs source file, and everything would be handy dandy. If you actually did this, however, you'd find it would be dependency hell to manage in your build script/makefile/whatever.

Instead, what everyone uses is the mod keyword. If Rust sees something along the lines of "mod foo;" it means to look in either foo.rs or foo/mod.rs. The problem with this, of course, is that modules are not compiled individually. In essence, the compiler is #include-ing those files, just without the multiple #include problem. If you have two files, a.rs and b.rs, and a.rs uses b.rs, you will have to recompile both even if you only change a.rs.

Scale the problem up, and it will suck. So what does everyone do? Use shitloads of libraries, just like in Node.js. Seriously, go build a random Rust project and see how many libraries you'll end up downloading; it's absurd.
>>
>>62156806
This is a really bad and completely not convincing "argument".
>>
>>62156817
Also Rust is an abysmal language by default so your argument's kinda redundant / beating a dead horse
>>
File: program modified.png (36KB, 483x523px) Image search: [Google]
program modified.png
36KB, 483x523px
Hey it's me again
I got my program to work.
I need some advice about the amount of words you can enter in because my program need to have no more than 1000 entries.
>>
>>62156817
they are reworking the mod/crate part of the language. 19 releases into the stable "1.0" :)
>>
>>62156879

They are? Is there like an issue tracker I could use to follow this rework?
>>
>>62156807

void definitely_not_strcpy(char *dest, const char *src)
{
while (*src != '\0') {
*dest = *src;
++src;
++dest;
}

*dest = '\0';
}
>>
>>62156904
https://github.com/rust-lang/rfcs/pull/2088

this is what I was thinking of, but it wouldn't solve your/the problem. at least I don't think so (the thread really took off...).

the micro-lib ecosystem with a tiny standard library is the least attractive part of Rust, in my opinion. but its what the community is used to.
>>
File: akari okeeei.png (103KB, 270x320px) Image search: [Google]
akari okeeei.png
103KB, 270x320px
>>62157022
you should rewrite this as
while (*++dest = *++src);
>>
>>62157090
one-liners with ++ and dereferencing triggers me.
>>
>>62156826
If its not in the top 5 in github or being massively shilled, its dead to /dpt/. But in reality its far from dead, desu.
>>
>>62157022
Okay I finally gave in and imported your shitty fucking gay library.

But it still doesn't add the characters, so I'm hoping you could again explain where I'm fucking up
char buffer[50];
strcpy(buffer, nouns[RAND_NUMBER_RANGE(0, num_nouns)]);

if (RAND_NUMBER_RANGE(0, 2) == 1) {
//find out whether we need to add "s" or "es" to the end
int len = strlen(buffer);

if (buffer[len] == 's')
buffer[++len] = 'e';
buffer[++len] = 's';
buffer[++len] = '\0';
}
printf("%s ", buffer);
>>
What kinds of algorithms would be used in dwarf fortress / factorio?
>>
File: 1488929856629.jpg (88KB, 1032x720px) Image search: [Google]
1488929856629.jpg
88KB, 1032x720px
>>62157090
akari is cute
code is cute too
>>
>>62157146
None that you would understand
>>
File: 1479883677181.jpg (143KB, 833x696px) Image search: [Google]
1479883677181.jpg
143KB, 833x696px
>>62157159
>>
>>62157090
Clean as hell. Though I don't like dereferencing a ++ either.
>>
File: 1500393095120.jpg (44KB, 605x864px) Image search: [Google]
1500393095120.jpg
44KB, 605x864px
I know this is a stupid question...

can someone explain what's happening here? line by line.

#include <stdio.b>
int main() {
print f ("hello, world!");
return 0;
}

i know this might seem silly to most of you, i'm having a bit of trouble understanding exactly what each part means
>>
where do you define the structure of a structure? globally, above all your functions, or in main?
>>
>>62157290
If every translation unit needs to know the layout of the struct, in the header, otherwise, I put it in it's translation unit at the top.
>>
>>62157274
>.b
1. you're including the standard in-out header for your compiler to reference for printf
2. youre declaring the entrance point of your program, it takes no arguments and is expecting an int return value
3.youre calling the 'print f" function (which won't compile because of the space) with "hello world"
4. youre returning 0 signifying your program exit'd successfully
>>
>>62157326
>>62157274
To add to this anon's answer, <stdio.b> should be <stdio.h>
>>
>>62157308
thanks
>>
>>62157274
>can someone explain what's happening here? line by line.
No, we can't. Explaining those details properly involves explaining a bunch of concepts that you will undoubtedly see in later chapters.

I can give a rough overview of the parts you can understand at this point, though:

>#include <stdio.h>
This indicates that you want to use a bunch of input/output-related standard functionality in your program. Having this line at the start of the program makes the `printf` function on line 3 available, as well as a ton of related functions.

>int main() {
>...
>return 0;
>}
I can't really explain this part yet. For reasons that your textbook will explain later and that for now you can consider unexplained magic, everything between here is the real content of your program. What exactly this means will follow soon, I'm sure.

>printf ("hello, world!");
(Note the missing space between `print` and `f` -- it should not be there.)
This line "prints" (which, in programmer terminology, means "displays on the screen", not "print on paper using a printer" -- the term derives from the historic machines that DID have a printer and did NOT have a screen, for which a program like this would actually print on paper) the text between the double quotes to the screen.

For now, the `printf` line is the only part you can really understand. Everything else, I suggest you take on faith for now, until your textbook gets to it.
>>
Fact: People who argue about languages are people who aren't able to build anything with them.
>>
>>62157070

Hrm... maybe this might make it easier to use .rlibs everywhere instead of modules. Doesn't seem that great though. If I ever make my own language, I'll need to remember "module system that doesn't suck" on the list of features to add.

Also, Rust's standard library isn't that small... It's just that it's not Java huge.
>>
trying to write tetris in C
>>
>>62157377
>add to this anon's answer, <stdio.b> should be <stdio.h>
anon caught it just fine. seems you missed it in his post.
>>
i'm doing multithreaded parallel prefix sums computation in C with a barrier, but it wants me to print the array at the end of every round. how should i approach that? it doesn't specify that you have to write it all on the same line in order, but that's how i interpreted it.
should i just print the index and value, and the round number? only thing other than that i can think of is it's going to have to use two barriers and wait for one of the threads to iterate over the array
>>
>>62157642
http://graydon2.dreamwidth.org/253769.html
is an interesting read about modules.
(from the original creator of Rust, back when it was written in OCaml..)
>>
File: 1444373945549.png.jpg (134KB, 762x613px) Image search: [Google]
1444373945549.png.jpg
134KB, 762x613px
>>62157204
>>
>>62156776
This
>>
>>62156817
Are you seriously saying CMakeLIsts.txt autism is any good?
I HATE CMakeLists with a fiery passion.
>>
>>62157728
hi pajeet. how's getting paid 15k/year to write 100 lines of java shitcode everyday going for you?
>>
>>62157773
Pretty good, how's that $12/hr burger flipping job at McDonalds going, autist?
>>
>>62157649
Cool keep us posted.

>>62157766
It honestly isn't really bad. The complexity comes from the portability requirements.
>>
>>62157823
> The complexity comes from the portability requirements.
I don't care, a standard build system would not prevent portability at all
>>
I actually found a solutions C++'s nomodules problem.

Write your main function in D, the rest of the project in C++
>>
>>62157326
>>62157377
>>62157479

thank you 4friends (that was a word play on "4chan" and "friends")
>>
>>62157866
business idea: write your whole project in D
>>
>start first job out of college doing embedded dev a year ago at a small business
>other programmer I was supposed to work with eventually gets fired, because he can't actually program
>start to juggle 3-4 projects at a time, because my boss has ADD
>end up getting lead dev duties after a few more months
>start having to talk to customers, manage interns working on desktop software, give estimates, organize large codebases, along with working on my other projects
>slowly start to fall behind on my other projects
>get stressed out
>ask boss if I can have interns help work on firmware
>he said no, because he's scared of having students touch firmware
>ask him if I can get a full time programmer to help with firmware
>he said he doesn't have the money.

Do I just give him my 2 weeks and tell him to fuck off? The pay isn't even good, it's only on par with other fresh college grads.

My only problem is I would feel bad for leaving, since there's a lot going on that needs my help, but at the same time, I could work another job that's less stressful and with more pay.
>>
>>62157766

There are many alternative build systems to CMake if you're building C or C++ programs. I just personally prefer it because it manages internal header dependencies better than just a standard Makefile, and is also able to handle nuanced differences in compilation across different platforms.

But regardless... you must admit that recompiling an entire project just for changing one source file is a bit ludicrous, right? Especially when you take into account Rust's compiler being notoriously slow already.
>>
>>62157882
That'd be nice, I'm looking forward to their new automem go get into the standard
>>
>>62157901
>There are many alternative build systems to CMake if you're building C or C++ programs.
Like meson? Depending on python to make your C++ work? I find that embarassing for purist languages like C++.


> you must admit that recompiling an entire project just for changing one source file is a bit ludicrous, right?
It is, don't they have incremental builds? Did you consult their IRC?
>>
>>62157845
You don't know what portability means then. It's not just a matter of the input but of the ecosystem too. Languages like Rust or Go can afford these things because they are new enough to (almost) have a single implementation.
>>
>>62157892
youre getting squeezed lad, get out.
>>
a unique situation has come up that has me traveling, but i still need to work on my cross-platform app using VS.

normally, everything is at home and the iMac is attached to the same network as my win10 machines and it's all gravy.

however this time, it would be very burdensome to take the iMac along. i really don't want to buy a new macbook just for this.

can i use a hackintosh laptop (T-420?) or would OSX 'know' and disallow the remote access needed by VS?
>>
>>62157924
Correct me if I'm wrong, but Rust is hosted on all LLVM supported archs, right? It's pretty damn portable if you ask me, why should standard builds suffer for the sake of niche arch portability in the first place?
>>
>look at javascript code
    });
});
});

Every. Single. Time.
>>
Learning tkinter
>>
>>62157968
>use a language that can compile to JS
>Never have to look at pajeet-S ever again
>>
File: 1480061951862.jpg (226KB, 1500x1000px) Image search: [Google]
1480061951862.jpg
226KB, 1500x1000px
>>62157952
>t i still need to work on my cross-platform app using VS.
Judging by your post, you would be the perfect fit for the kind of people that carry their macs
>>
>>62157986
that's funny.
you're clever.
>>
Have to write a report for data stored in a sql database.

I have an initial population of people and 36 metrics that are stored across close to 30 different tables. Some of the population will have some of the metrics while others don't.

How should I write this?
1) Just one big ass query hitting everything I need
2) Create an initial population temp table and then apply the data points for each section as I go

There may need to be the need for an ETL process for this at some point.
>>
>>62158005
For you, everyone is clever
>>
>>62157960
>Rust is hosted on all LLVM supported archs
Rust's back-end is LLVM, doesn't mean it will work well on all LLVM supported architectures (see their website for the full list). You still have to properly wire your front-end into it and there are platform specific considerations to have (for function passes among other things). And then there is how the OS lays libraries out, the standard library etc... Like I said, portability is not just a matter of the language.
>why should standard builds suffer for the sake of niche arch portability in the first place
Rust is an example of language where "portability" only depends on the arch. For other more mature languages, you also have different compilers, ABIs, etc.
Your opinion is valid if you only want your language to be properly supported on a few platforms, and a standard build system is nice, I'm just saying it's not always realistic to have. Adding a "build system" into the C++ standard now for example would probably break many projects in regards to forward compatibility.
>>
>>62158020
sounds like a game of Guess Who
>>
rust is shit
>>
>>62157919

Meson, Make, Rake, Autotools... whatever you prefer, really. A build system is just a configuration file or script to describe how the program is built. And it can be in Python, that's fine. It'd be a bit silly if the build script was a .cpp file, no?

>don't they have incremental builds?
I'm pretty sure "incremental builds" is not what we're talking about here.
https://en.wikipedia.org/wiki/Incremental_build_model

>Did you consult their IRC?
Nah. I consulted one of the more commonly used Rust books:
https://rustbyexample.com/crates.html

>If some_file.rs has mod declarations in it, then the contents of the module files will get merged with the crate file before running the compiler over it. In other words, modules do not get compiled individually, only crates get compiled.
>>
Could anyone good with Verilog help me out?

I have a module with an input in bits, and I don't know the syntax to give that input with individual bits. (Basically, I'm implementing a multiplexer.)

//partial code

module Mux(
input [2:0] Select
);

//stuff happens
endmodule

//S1, S2, and S3 are output regs declared elsewhere. They all contain either 1 or 0.

module ExecuteComponents();

Mux m( .sel[0](S1), .sel[1](S2), .sel[2](S3) ); //my guess for how it would look

endmodule


It doesn't compile correctly. How should I be passing in the individual bits of Select?
>>
>>62158038
>Rust's back-end is LLVM
I made one of the mistake I hate. I meant rustc's back-end is LLVM. Although since it's the only implementation the amalgam isn't too harmful.
>>
>>62158053
Correction: .sel should say .Select. I changed the code to be more descriptive here, but didn't finish that part.
>>
alrighty I gotta question. Which lang should I learn next: Haskell, scala, elixir, nim, crystal, go or rust. You decide.
>>
>>62158130
we need more nim posting.
>>
>>62158130
You should learn more about the languages you've already learnt.
>>
>>62158130
Go is a shitty meme.
HASKAL is good if you want to be a professional blog writer.
Rust is okay, but has an actual cult around it.
Dunno about the rest, but they're probably fine.
>>
>>62158053
I know shit all about verilog, but I recall two ways from when I fucked around with it for a bit:
Mux m( { S1, S2, S3 } );

or:
wire [2..0] mux_shit;
assign wire[2] = S1;
assign wire[1] = S2;
assign wire[0] = S3;
Mux m( mux_shit );


Not sure whether those bits should be in left-to-right or right-to-left order. It's been a while.
>>
>>62158130
Rust
>>
>>62158199
Whoops
wire [2..0] mux_shit;
assign mux_shit[2] = S1;
assign mux_shit[1] = S2;
assign mux_shit[0] = S3;
Mux m( mux_shit );


Of course, the real answer is that Mux should not take an array in the first place, but rather three separate inputs.
>>
File: 000119-Twitch.png (363KB, 540x421px) Image search: [Google]
000119-Twitch.png
363KB, 540x421px
my aero model is written in fortran 77 and its pissing me off
>>
>>62158199
Yup, I just tried something similar to the top one and it compiles.
Mux m( .Select({S1, S2, S3} );


I'll figure out the bit order sometime soon, thanks.
>>62158220
The sample code I was given for the module has Select written like that, so I'll keep it that way.
>>
>>62158130
>pure functional
>object-oriented functional
>concurrent functional
>concurrent imperative
>object-oriented
>concurrent imperative
>whatever Rust is
Make your mind up. Also learn J, Prolog and Erlang.
>>
>>62158268
Rust is the autistic, bastard child of functional and imperative.
>>
>>62157952
bump for wasting money on a macbook/wasting a day getting hackintosh working.
>>
>>62157090
Not correct behavior.
Fixed:
while (*dest++ = *src++);
>>
>>62158340
Just use a VM you mong
>>
File: akari928.png (1MB, 1120x1078px) Image search: [Google]
akari928.png
1MB, 1120x1078px
>>62158358
If you pass in a pointer to an unterminated char array, you deserve to SIGSEGV!
>>
>>62158381
VS doesn't allow emulation via VM, you turd.
>>
>>62158420
then dont use VS?
Stop being a brainlet.
>>
i have a perlin noise function in C, when i call it twice in a row with the exact same arguments and everything, the return value of the second time is double that of the first.
Can someone explain to me what witchcraft is happening here?
>>
So basically completely new to programming, everyone is telling me to start with C. What is the best place to start?
>>
>>62158446
Sure, let me just summon my dark spirit to peer into your code. But maybe instead you could quit being a baka and include it.
>>
>>62158446
line 5
>>
>>62158460
javascript or php, don't listen to the trolls
>>
>>62158420
>VS doesn't allow emulation via VM, you turd.
Top kek wincucks are the weakest cucks of the world
>>
>>62158497
Fuck off with the disinfo /wdg/
>>
>>62158497
>>62158518
Should I buy a book? Use codecademy? I want to start from the basics so I don't get fucked later
>>
>>62158527
physical books are comfy.
But what kind of dev do you want to do lad?
>>
>>62158527
yeah use code academy to learn php or javascript. or both! best of luck, good friend
>>
>>62158472
double noise(double x, double y, double z, int seed) {
int perlin_ywrapb = 4, perlin_ywrap = 1 << perlin_ywrapb;
int perlin_zwrapb = 8, perlin_zwrap = 1 << perlin_zwrapb;
int perlin_size = 4095, perlin_octaves = 4;
double perlin_amp_falloff = 0.5;
double perlin[perlin_size];
srand(seed);
for ( int i = 0; i < perlin_size; i++ ) { perlin[i] = 1.0 / RAND_MAX * rand(); }
if ( x < 0 ) x = -x; if ( y < 0 ) y = -y; if ( z < 0 ) z = -z;
// Interpolate then return

...


while (shit) {
a+=0.01;
x = noise(a,0,0,0);
y = noise(a,0,0,0);
>>
>>62158547
Probably make mobile apps and websites since those have the most demand, but preferably something pajeets cant shit out in 2 seconds, any books you recommend to start? I don't really know what I liked yet so I would be open to try different languages

>>62158550
Are you being ironic?
>>
>>62158460
if you are new and don't know where to start, try freecodecamp .org? .com?
easy to do and should you complete it, you would have enough skill/experience to do some basic freelance work to build your portfolio. plus it gets your brain in logic mode so you can add other languages later.
>>
>use C and work with hardware every day for work
>kind of want to learn a desktop-friendly language and maybe contribute to FOSS

What should I learn? I'm thinking about either C#, C++, or Rust, but I'm afraid that C# gets me cucked by Microsoft, C++ is ugly as shit, and Rust will probably end up dying.
Are there other languages worth learning?
>>
>>62158606
Try D or Nim
>>
>>62158590
Then youll need swift for IOS, dont even bother with Android. And for webshit, avoid JS (unless youre trying to get a job as a webdev) and look into all the languages that can compile to JS
>>
>>62158595
Will check it out, thank you kind anon, do you have a place like a discord or IRC or whatever you use to ask questions and discuss programming?
>>
>>62158401
That has nothing to do with the matter.
while (*++dest = *++src);
is incorrect. It will copy all characters in the string except for the first one. If it's an empty string--by which I mean, if it's a pointer directly to a null character--the behavior will be undefined.
while (*dest++ = *src++);
avoids this problem.
>>
>>62158622
Ok got it for Swift
But not really sure what you meant about the languages that can compile to JS, I found this website https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js
Not really beginner friendly for me.
>>
>>62158634
unironically, start with ruby. it's a good language for novices without being smelly like java. and there's a big enthusiastic community for it. if i had to pick a language to start with i'd have chosen ruby, knowing what i know now
>>
>>62158621
>He's worried about Rust dying
>Suggest D or Nim
>>
https://gist.githubusercontent.com/alessonforposterity/832da4fab11e10609dad/raw/258df12378399919ae088ba8731a7571d9c2c947/drgn.txt

:thinking:
>>
>>62158606
Are you going to contribute the the existing projects? C is your best option.

Want to make a new app?
Use a language that helps you, use D with GTKD.
Want to write a performance oriented language that also has high level features?
Try C++ or Rust.

Are you going to be the solo developer who needs productivity? Use Nim
>>
>>62158665
Do you recommend a youtube channel, website or book to start with Ruby?
>>
>>62158678
/dpt/ babbies don't know what ``dying`` means
>>
>>62158665
desu crystal is an altogether superior language it has all the good shit ruby has without being slow and also without letting you do all the nasty shit that ruby lets you do that makes ruby gross
>>
>>62158659
You can use other languages that can compile down to a .js file. Because JS itself is pretty awful. Although there is typescript which is Javascript with an a type system (which is important, dont let anyone else tell you otherwise).

Webdev is kind of a clusterfuck, so good luck. >>>/g/wdg/ has a nice little flowchart though for new people.
>>
>>62158716
Ok thank you, to be honest I'm more interested in developing apps rather than websites, since I basically see people use them all the time (also myself). Do you have any recommended resources for Swift? Preferably to start from scratch. Sorry if I'm asking too much, I don't want to fuck up from the start and waste a lot of time.
>>
>>62158812
Apple's documentation is pretty good.
https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID309

You could also search around for the top swift books and the pirate the pdf or something. There's an anon here who occasionally posts his mobile game so he could help as well.
>>
>>62158869
Good, I'm staying the night reading all of this, is there any place to consult other programmers like you? /wdg/ for example has a discord
>>
>>62158902
/dpt/ doesnt really like discord, but youre welcome to keep posting here.
Reddit probably has a r/swift , and possibly an irc or discord.

And theres also >>>/vg/agdg/, but they tend to shitpost a bit and you'll get flack for mobile posting, but there are some other mobile-devs there.
>>
>>62158902
>other programmers like you
reddit
>>
>>62158702
https://github.com/crystal-lang/crystal/pull/4855#issuecomment-323546639
but crystal doesn't scale.
>>
>>62157022
char* strcpy(char* const d, const char* s) {
for( char* x = d ; *x = *s ; x++, s++ );
return d;
}
Also does C allow me to do the following? If so, do arrays decay to pointers when used as return values? Feeling dumb right now.

char strncpy(char d[static const n], const char* s, size_t n)[static n];
>>
>>62156754
I need to have a portable Python interpreter around in a Zip Disquette.
How?
>>
>>62157142

#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
char *nouns[] = {"Faggot"};

int len = strlen(*nouns);

char* buffer = (char*)malloc(len+2);
strcpy(buffer, *nouns);


if (buffer[len-1] == 's') {
buffer[len] = 'e';
buffer[len+1] = 's';
buffer[len+2] = '\0';
} else {
buffer[len] = 's';
buffer[len+1] = '\0';
}

printf("%s ", buffer);
free(buffer);
return 0;
}


you forgot to subtract 1 from len in your if statement?
>>
What happened to the Dlang-chan poster?
>>
>>62159116
died, like the language
>>
>>62159116
stopped posting hopefully, he was spamming like a faggot anyway.
>>
>>62159135
How is D dead?
>>
>>62158994

The strcpy() and strncpy() functions return a pointer to the destination string dest.

Gut says you can't do that
>>
>>62159161
what do you think the d stands for, anon?
>>
>>62158650
And this is why I take the extra steps.
>>
>>62159172
Dick
>>
>>62159172
D stands for dick
>>
>>62159172

dickhead?
>>
>>62156776
This
>>
>>62159184
It's dick, if you claim otherwise you never went outside the room
>>
>D stands for dick
>C stands for cunt
>Dick fucks cunt
>D fucks C
>>
File: groovy_java.png (269KB, 700x350px) Image search: [Google]
groovy_java.png
269KB, 700x350px
Why do people here still write in Java when there are far better alternatives?
>>
>>62159246
Because Java is already popular. Same reason why people use C++
>>
>>62159264
But there is no better alternative to C++ anon.
>>
>>62159264
Sure thing Rustlet.
>>
>>62159276
There is, people didn't pick it up, like D.
Rust might change that

>>62159282
Enjoy no modules
>>
>>62159291
>This is how deluded Rustlets are
>>
>>62159346
Nice argument
>>
>>62159353
>provides no argument of his own
>gets butthurt when other people call him out on his retarded statements
Like clockwork.
>>
File: 1493337694901.png (149KB, 386x395px) Image search: [Google]
1493337694901.png
149KB, 386x395px
>>
File: 1474401525073.jpg (22KB, 197x420px) Image search: [Google]
1474401525073.jpg
22KB, 197x420px
>>62159408
>lokking for argument is now being butthurt
>>
>it's all just shit-flinging, AGAIN
Tell me someone is working on something, i don't even care if it's babby's first command line calculator
>>
>>62159532
Getting back into my vulkan wrapper desu, gonna re-write it all as pure as i can get.
>>
>>62159558
Sounds fun, how does using Vulkan actually compare to using OpenGL?
>>
>>62159493
>I bring claim
>you disprove it
>>
>>62159609
Not him but Vulkan is actually not fun at all. On Debian 9 with a Radeon R9 270X no program will start no matter how many drivers you install
>>
>>62159609
Its a lot more tedious but you have a lot more power and customization. There are some design patterns i kind of hate, like having to call the same function twice because youre q'ing for something and then filling an array up. And at times things can silently fail because you forgot to init a useless struct member. But if you love C, then you'll be right at home because the whole API is the epitome of it. C/sepples have some pretty good guides.
>>
>>62158606
>desktop-friendly language
Tcl/Tk.
>>
>>62158052
Rust wouldn't benefit much from incremental builds because of the heavy reliance on generics and the instantiation-based implementation strategy
>>
What am I doing wrong?

import sqlite3

class WaterDB:


def __init__(self):
pass

def connect(self):
conn = sqlite3.connect('test1.db')
global c
c = conn.cursor()

def createTable(self, name):
c.execute("CREATE TABLE ? (id integer)", (name))


if __name__ == '__main__':
a = WaterDB()
a.connect()
a.createTable("test")
>>
>>62159877
is line 15's string supposed to be "Create Table"?
t. have never touched python
>>
>>62159877
Using Python.
>>
>>62159877
Hi anon. Sorry I am not going to be able to help you but I want to know how you, as a python user, think about Nim
https://nim-lang.org/
>>
>>62159877
Isn't the execute() a sqlite3 method? Shouldn't you call it like this: "c.sqlite.execute()"? I'm also new to python.
>>
>>62160027
>>62159910
nope
>>
Learning about doubles
According to wikipedia, when the exponent part of the double is
 11111111110 
, the value is 2^(2046 - 1013), but for ints, the equivalent string of bits would be 2046.
(source: https://en.wikipedia.org/wiki/Double-precision_floating-point_format)

Why do doubles use "offset-binary" representation while ints, shorts, chars, and longs all use a regular binary expression?
>>
Now that node is in the process of destroying itself from the inside, what technologies should I be looking into?
>>
>>62160055
>everything is a long,typo prone string
Looks like youre missing a comma between id and integer.
I'd just find something better though, desu
>>
File: 1444468482564.jpg (53KB, 300x725px) Image search: [Google]
1444468482564.jpg
53KB, 300x725px
/dpt/ I have a question but I'm not sure how to phrase it, so bear with me please.
Can someone convey to me the time-span projects of various size take for the average person? I feel like I am at a stage of proficiency where I know what is good practice and can get things done, the problem for me though is that I feel like I accomplish such things well, but slowly. The issue above this is that I'm not sure if I'm actually slow or if it's typical for some things to take a lot of time for a single person, there doesn't seem to be data for me to compare with, there are git commit dates but that's not really indicative of how many hours something took, just when work was submitted.

Also if I come to the conclusion I am slow, does anyone have any advice on how to program at a faster pace? I don't mean like typing or a fancy editor, I mean improve my abilities to think about these things, I feel like if I'm slow I might be slow forever, which is kind of bad.
>>
File: 1362960884713.png (102KB, 241x228px) Image search: [Google]
1362960884713.png
102KB, 241x228px
What's a good resource for "professional" .NET development? I've been writing stuff for personal use for a while now without really caring about how the project was structured, or security, or anything like that, but I want to write some stuff that'll be publicly released now and I don't want to embarrass myself.
>>
>>62160065
>https://en.wikipedia.org/wiki/Exponent_bias
>Biasing is done because exponents have to be signed values in order to be able to represent both tiny and huge values, but two's complement, the usual representation for signed values, would make comparison harder.
It looks like offset-binary is more efficient in this circumstance. We don't use offset bias for integers because it's nice that unsigned addition/subtraction is identical to two's-complement signed
>>
>>62160168
dumb frogposter
>>
>Write a program that creates a linked list of bunny objects.
NO
Why would I EVER need linked lists in the current year?
>>
>>62156754
daily reminder that lisp is a retard language.
>>
>>62160202
Bunnies linked together sounds cute.
>>
>>62160163
Yes! Hang yourself
>>
>>62160202
Linked lists are more relevant now than ever, though?
>>
>>62160231
That's RUDE.
>>
>>62160239
Why not use an array of structs?
>>
>>62160185
That makes sense...
One more question: If doubles only use exponents of base 2 for the "integer" part, how do doubles get values like 17?
>>
>>62160239
https://www.codeproject.com/Articles/340797/Number-crunching-Why-you-should-never-ever-EVER-us
>>
>>62160264
If you need me to go over the pros and cons of arrays versus linked lists, then I think you don't really understand the problems both are designed to solve, friend.
>>
>>62156754

I've read K&R and several C++ books, and I'm familiarizing myself with the STL. I'm really curious about parsing files that aren't plain test. Say I want to read metadata from an PDF. Without looking at some spec, how would you usually go about parsing it? If I were to open it in a hex editor, where do go from there to be being able to read it and output data, and later manipulate that data? I know it's not simple, but I was wondering if there are resources a process like this.
>>
Should I learn Ruby or Python if I just want to automate shit? Like bash scripts but maybe more complex.
>>
File: 1491319126974.png (125KB, 722x1207px) Image search: [Google]
1491319126974.png
125KB, 722x1207px
>>62160409
Looks like an unnecessary head ache to me. Vector of tuples would do a better job
>>
>>62160486

I don't mind looking at some libraries it'd help me understand the process of things. I'm very interested in the "how".
>>
>>62160509
I'm sorry m8 I totally misread your post lol
>>
Google
>Parameters to C/C++ functions are either input to the function, output from the function, or both. Input parameters are usually values or const references, while output and input/output parameters will be non-const pointers.

ISO CPP
>Note: Old line C programmers sometimes don’t like references since they provide reference semantics that isn’t explicit in the caller’s code. After some C++ experience, however, one quickly realizes this is a form of information hiding, which is an asset rather than a liability. E.g., programmers should write code in the language of the problem rather than the language of the machine.

What does /g/ think?
>>
What are some .net core use cases?
>>
>>62160550
>programmers should write code in the language of the problem rather than the language of the machine.
I agree with the sentiment but I don't know if references fit that statment.
>>
For those who have done iOS development, are builds always this slow?
>>
File: howto.jpg (2MB, 1000x1330px) Image search: [Google]
howto.jpg
2MB, 1000x1330px
I hope you've been keeping up with your z80 Assembly learning, anon.
>>
This doesn't compile. what gives?
#include <iostream>
#include <filesystem>
using namespace std;
using namespace filesystem = fs;

int main() {
cout << fs::current_path() << endl;
}
>>
>>62160638
>filesystem = fs
>>
>>62160600
Are you using Swift? It's normal for Swift to be dogshit slow. Seriously consider using good old Objective-C.

I made my first iOS app in Swift, and my second in Obj-C. So much better. There's no way I'm going back to Swift. The tooling is horrendous, bridging to C is annoying, and bridging to C++ is basically impossible (have to write a C wrapper and bridge to that). I use sqlite and I loved being able to just call it like any C program. Fuck your Bridging-Headers and fuck your COpaquePointers, Apple.

And yes, the compile times are utter dogshit.
>>
>>62160651
#include <iostream>
#include <filesystem>
using namespace std;
// namespace filesystem = fs;

int main() {
cout << std::filesystem::current_path() << endl;
} // compilation error
>>
>>62160600
Shit question with no point of reference.
Takes me about 10-15 seconds to build and run on a device.
>>
>>62160662
Using Xcode and Unity.
>>
>>62160673
>>62160638
Is it a nigger thing to say it does not compile and not bother posting the error message from compiler? Like, you don't actually want help, you just want to make a complaint.
>>
>>62160695
user0@primary ~/devel/vsc++ % g++ main.cc -std=gnu++17                                                                      :(
main.cc:2:10: fatal error: filesystem: No such file or directory
#include <filesystem>
^~~~~~~~~~~~
compilation terminated.
>>
File: wZqVRRl.gif (231KB, 800x508px) Image search: [Google]
wZqVRRl.gif
231KB, 800x508px
>>62160588
coming from C, I prefer seeing some distinction between in/out parameters.

checked some major c++ projects and seems it's split in half.
LLVM and bitcoin use references only.
Chromium and TensorFlow use const ref + pointer style.

the question now is, which projects are better?
>>
File: 560.jpg (97KB, 480x522px) Image search: [Google]
560.jpg
97KB, 480x522px
Did you buy a /g/ hoodie to go with your programming socks?
>>
>>62160550
The stupid C++ cucks don't even address the complaint at all.
Why the fuck would you defend invisible state changes?
>>
>>62160703
user0@primary ~/devel/vsc++ % g++ --version                                                                                 :(
g++ (GCC) 7.1.1 20170630
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

user0@primary ~/devel/vsc++ %
>>
>>62160693
Oh okay, that sounds more like a Unity issue than an iOS one, really.

These might help:
https://docs.unity3d.com/Manual/IL2CPP-OptimizingBuildTimes.html
https://forum.unity3d.com/threads/unity-5-xcode-7-64-bit-il2cpp-compile-times-are-killing-me.357487/
>>
>>62160252
Sauce?
>>
>>62160717
>il2cpp

I fucking knew it was something like that
>>
>>62160703
>>62160716
Looks like it's not implemented. Try with -std=gnu++1z flag?
>>
>>62160705
I'm going to guess the half and half is better, using references for read only data and pointers for writable data should avoid unnecessary copying from references, right? Most outputs would be pointers unless they return something akin to a handle.

What do you think?
>>
>>62160735
Still no go. Apparently libc++ cucks are working on it
>>
>>62160703
g++ 7.1 doesn't support filesystem, outright.
its still in:
#include <experimental/filesystem>
// and to make it less annoying to type
namespace fs = std::experimental::filesystem::v1;
// maybe v2 is available, I don't use GCC.

make sure to link against stdc++fs
>>
File: g's Official Language Chart.jpg (1MB, 620x4144px) Image search: [Google]
g's Official Language Chart.jpg
1MB, 620x4144px
>>
>>62160805
>Implying anybody codes in binary
>Implying they don't at least use hex
>>
>>62160715
see >>62160705 senpai
just checked some moar, electron and swift uses google's style.

>>62160745
I agree. performance should be identical, it's just about style.
>>
>>62160805
matlab's overrated.
>>
File: 1503937292458.jpg (56KB, 645x773px) Image search: [Google]
1503937292458.jpg
56KB, 645x773px
>>62160861
Sure thing brainlet.
>>
Python script to install my dotfiles
>>
>>62159628
>>62159493
Wow, you guys are both too lazy to make any arguments. What a world.
>>
hey, just got a job at major company working in crystal reports. How fucked am I?
>>
>>62161043
You're probably over-engineering your shit, just use git and stow/xstow.
>>
Where do you go when you have a question about vim? I'd go to the irc channel but it requires registration and I won't do that.
>>
>>62160625
m8 i know z80 and m68k fucking debate me i dare u
>>
>>62161199
Go stand an hour in the corner and rethink your decisions.
>>
>>62160625
Why does she have a whip?
>>
Should I learn erlang
>>
File: branson delegate.jpg (52KB, 970x546px) Image search: [Google]
branson delegate.jpg
52KB, 970x546px
Hello gentlemen. I'm looking for junior devs, pajeets, neets and anyone who is willing to become my slave. I have an offer that can be interesting for you.

I have a side-project with some commercial potential, but I don't have enough time to develop it myself. So, I'm looking for people of any skill level who want to practice and do job for me. I will give you tasks, and you will be free to implement them in any way you want — microservice hell is what we will create.

What is your benefit?
- You will get real tasks. If you are learning to code, real-world task may be good for you to understand what expects you in the industry;
- You will get some experience of working with a real client. You will see how real-world interaction may look like;
- My feedback and code review may help you improve your skills;
- You'll be able to add "I know how to develop microservices" line into your CV;
- When the project becomes profitable, you risk getting a low-paid laid-back job, you will have the opportunity to feel the pain of microservice integration and so on.

What is my benefit?
- Free coders;
- Opportunity to find people for future mutually-beneficial exploitation.

Interested? Contact me via [email protected]
>>
>>62161246
We conjure the spirits of the computer by force with our whip.
>>
>>62161268
It's a very interesting language, especially if you're not used to functionnal programming/the actor model.
I'd say yes.
>>
>>62161275
This guy has 48 Pajeets working in a sweatshop under his house.
>>
sahhh finally got the images to actually use the proper aspect ratio
>>
File: matlab 8gbs.png (29KB, 903x609px) Image search: [Google]
matlab 8gbs.png
29KB, 903x609px
>>62161033
>>
>>62161447
>ramlet
>uses google chrome
>plays league of legends
Well done on proving what an idiot you are.
>>
>>62161484
It's not my screengrab you utter fucking moron, do you think I'm such a fucking codelet that I'd install Matlab on my computer?
>>
>>62161275
If you want people to work for you, you have to pay them.
>>
>>62161505
[citation needed]
>>
>>62161496
>getting this aggro in a fit of denial
You're not fooling anyone, kid.
>>
>>62160638

#include <experimental/filesystem>
>>
>>62161354
At least they have a job.
>>
Allright /G/ents.

Due to circumstances I will lose my job, boss will pay for schooling.

I'm interested in programming, I do have a very little understanding of Java.

What books u guys recommend?
I like reading about things and on my coming holiday I have some time to read.

I'd like to get more in to programming, first of the basis.
>>
>>62161505
Sometimes people work for free. I myself have done some free/opensource work. But, unlike random opensource project, I will provide guidance, give feedback and show a way to improve.
For experienced developer my offer has no value, but juniors may be interested.
>>
>>62157090
MISRA C uncompilant. Please take your unsafe hobbyist C elsewhere.
>>
>>62161550
>accuse me of being a fag
>>that's obviously not me you fucking fag
>w-why are you being so defensive? *uninstalls /v/ trash*
>>
>>62161600
I recommend you learn by doing
in this industry, books are things you read when you're already intermediate or better
>>
>>62161484
>not having been here for even a month
https://archive.rebeccablacktech.com/g/thread/61398050/#61398768
embarassing
>>
>>62161665

No good books for the basics whatsoever?

Like ..... For dummies
>>
>>62161703
of you want a programming language for absoloute retards?
K&R C can be finished in an afternoon, go get that
it like 50 pages
>>
>>62161720
I'm not going to say K&R is hard, but it's not a beginner's book.
>>
>>62161703
>No good books for the basics whatsoever?
no, not compared to online resources
remember, the thing about books is that they have to get published
95% of the content in a beginners book will be filler
which means 95% of the time you spend reading it is wasted
>>
>>62161703
codeacademy python and then K&R is what I recomend to any friends that want to start programming with minimal/no experience
>>
>>62161759
>>62161720

So, taking a laptop with me and just do it.
Is going to work out better than reading stuff.
Of course with the online help.

But then..
Continue with Java or switch to another language?

What I want to do is learn some versatility with programming.
A lot of jobs to find here in Java, C and C++
>>
>>62161808
Become my slave and you'll learn everything needed for real work.

Java is a popular language, you will easily find a job with it. If you need even more versatility, you can look at javascript. It is ubiquitous.
>>
>>62161743
but it was a beginners book.. but I guess back then you couldn't be "tech" illiterate and expect to write programs.
>>
File: oop is shit.jpg (173KB, 700x350px) Image search: [Google]
oop is shit.jpg
173KB, 700x350px
How accurate is this?
>>
>>62161872
i dont get it
>>
>>62161865
It's a "beginner to C" book, but not a "beginner to programming" book.
>>
>>62161858

Hah, as long as there's learning.
Too long without some brain teasing.
>>
>>62161872
Procedural and object oriented programming are the same fucking thing. Why doesn't /g/ care about actually different paradigms such as the actor model, event-oriented programming or dataflow programming?
>>
>>62161981
data oriented design was a meme for a while
technically not a paradigm, but it probably should be considered one
>>
>>62161908
the C they teach isn't inherently hard. its actually rather simple.
because of its simplicity, a bunch of shit is written in legalese about whats undefined, implementation-defined and well-defined behavior for the C Abstract Machine. which leads to the the only "difficult" part of C.
it is knowing whats UB and IB and what you're supposed to do, or can even do to get around them. the CAM stuff is rather simple to learn, relative to what the compiler is going to do to it to run on a real machine.

but sure, doing anything useful with what you're taught in k&r2, alone, might be a bit frustrating..
>>
How is this code able to compile and deduce a type for the template parameter F?
You couldn't do any such things before the auto parameters of c++1y. Explain this sorcery to me.
#include <boost/core/demangle.hpp>
#include <iostream>
#include <typeinfo>

template <class F>
void foo(F &&f) {
f("foo");
f(777);
f(3.14);
}

int main(int argc, char *argv[]) {
auto f = [](const auto &x) {
std::cout << "Got value '" << x << "' of type "
<< boost::core::demangle(typeid(x).name()) << "\n"; };
foo(f);
return 0;
}


->
Got value 'foo' of type char [4]
Got value '777' of type int
Got value '3.14' of type double
>>
>>62162095
auto generates a C++ "functor" class (awful name choice) that has a template
when you call f("foo") it instantiates that for std::string or const char* whichever it is
>>
>>62161981
>Procedural and object oriented programming are the same fucking thing
God damn, you're fucking stupid.
>>
>>62160163
>I don't mean like typing or a fancy editor
these things help though. think of it as an OODA loop. faster iteration = faster completion. you could try writing a program to record your input into an editor and profile that, to get a sense of how much time you waste searching for things, or dealing with indentation and other aesthetic things.

Beyond that, much of it is about making sure your program is structured so that you can easily follow and prove things about it to yourself, which is where typechecking, scope, use of pure functions, careful memory management, etc. help.
>>
>>62162095
>>62162112
if you think about it it's really no different from top level

void f(const auto &x) { ... }
or
template <typename T>
void f(const T& x) { ... }

void foo() {
f("foo");
...
>>
>>62162114
>Hurr durr let me call this function that accesses the global state
>Hurr durr let me call this function that accesses a data structure that is itself a representation of a part of the global state
Prove that I'm wrong, faggot
>>
How do you motivate yourself when you have to program something boring.
>>
>>62162145
I drink. It doesn't motivate me but makes the work more bearable.
>>
>>62162145
Don't program anything boring.
>>
anyone have any experience writing physical simulations and could point me to some good resources on the topic?
>>
>>62162118
>these things help though
I agree/know, I have adopted advanced editors as a result, I mentioned it because I'm wondering if there is anything else I can do outside of that or if that's the line.
>>
>>62162136
Global state has nothing to do with this.
>>
>>62162175
If your functions have no side effects you're doing functionnal programming.
>>
>>62162187
Side effects do not necessarily mean they're affecting global state; it's just state outside of the function.
void fn(int *arg)
{
*arg = 0;
}

is has a side effect, but is not (necessarily) modifying global state.
>>
>>62156754
How do I refactor my makefile?

all: ../rsc/g.cfg lvl0 lvl1 lvl2 lvl3 lvl4 lvl5 lvl6 lvl7 lvl8 lvl9 lvl10 lvl11 lvl12 lvl13 lvl14 lvl15 lvl16 lvl17 lvl18 lvl19 lvl20 lvl21 lvl22 lvl23 lvl24 lvl25 lvl26 lvl27 lvl28 lvl29 lvl30 lvl31 lvl32 lvl33 lvl34 lvl35 lvl36 lvl37 lvl38 lvl39 lvl40 lvl41 lvl42 lvl43 lvl44 lvl45 lvl46 lvl47 lvl48 lvl49

../rsc/g.cfg: ./rsc/g.cfg
cp ./rsc/g.cfg ../rsc/g.cfg

lvl0:
./lvlgen.py < ./rsc/0.cfg > ../rsc/0.lvl
./flgen.py < ./rsc/0.cfg > ../rsc/0.frames
./sflgen.py < ./rsc/0.cfg > ../rsc/0s.frames

lvl1:
./lvlgen.py < ./rsc/1.cfg > ../rsc/1.lvl
./flgen.py < ./rsc/1.cfg > ../rsc/1.frames
./sflgen.py < ./rsc/1.cfg > ../rsc/1s.frames

lvl2:
./lvlgen.py < ./rsc/2.cfg > ../rsc/2.lvl
./flgen.py < ./rsc/2.cfg > ../rsc/2.frames
./sflgen.py < ./rsc/2.cfg > ../rsc/2s.frames

lvl3:
./lvlgen.py < ./rsc/3.cfg > ../rsc/3.lvl
./flgen.py < ./rsc/3.cfg > ../rsc/3.frames
./sflgen.py < ./rsc/3.cfg > ../rsc/3s.frames

lvl4:
./lvlgen.py < ./rsc/4.cfg > ../rsc/4.lvl
./flgen.py < ./rsc/4.cfg > ../rsc/4.frames
./sflgen.py < ./rsc/4.cfg > ../rsc/4s.frames

# ... 44 more blocks ...

lvl49:
./lvlgen.py < ./rsc/49.cfg > ../rsc/49.lvl
./flgen.py < ./rsc/49.cfg > ../rsc/49.frames
./sflgen.py < ./rsc/49.cfg > ../rsc/49s.frames
>>
>>62162203
This function is accessing the global state. It's modifying something that exists outside of its scope.
>>
>>62162150
>>62162159
I can't be drunk at my job, and usually they give me cool stuff to do, but I'm gonna have to work on a shitty thing for a week or so.
>>
>>62162236
>I can't be drunk at my job,
get a job at another company
decent software developers are in such demand that places are starting to let you drink at your desk
>>
>>62162278
You're living in the past.
>>
>>62162206
https://www.gnu.org/software/make/manual/html_node/Functions.html#Functions
>>
>>62162293
is this specific to GNU make or is it good of POSIX make too?
>>
>>62162301
no clue
>>
>>62162150
software development turned me into an alcoholic. Back in college I was drinking at parties and I worked alone in a basement so I'd drink off hangovers pretty regularly.

Then I got my first job and it was so boring I'd spike my coffee to the point it was more whiskey than coffee

Now I work from home and I'm drunk for like 12 hours a day every day.

fuck it, at least I don't have to plan for retirement like this.
>>
>tfw I've been dry for 12 years
This was probably the worst decision of my life, it's basically killed my social life, and I can't even take off the edge occasionally because I'm afraid I won't be able to control myself if I start drinking alone.
>>
Anyone familiar with http clients? Just doing some basic stuff. I don't understand the point of a lot of the options in the request header. It seems like no matter what I put in there, web servers don't care? Is it just extra information for the web developer in case they choose to use it for something?
>>
>>62162445
>It seems like no matter what I put in there, web servers don't care?
That's not true, they do care. For example, what you put in the accept header determines the data format of what you receive back.
>>
>>62162206
You're fundamentally using makefiles wrong. A rule specifies how to make a particular file, not just some random name you picked.
It really should look like
rsc/%.lvl: rsc/%.cfg
./lvlgen.py < $< > $@

rsc/%.frames: rsc/%.cfg
./flgen.py < $< > $@

rsc/%s.frames: rsc/%.cfg
./sflgen.py < $< > $@

In terms of making the "lvlN" rules more general, it's not easy to do. Making pattern phony make rules is not easy.
>>
>>62162453
That was one of the things I tried messing around with. Didn't seem to affect it.

Might just because I'm only connecting to JSON APIs, so it just sends json no matter what you request.
>>
>>62162479
>That was one of the things I tried messing around with. Didn't seem to affect it.
Then you might be asking for MIME-types it doesn't support.

>Might just because I'm only connecting to JSON APIs, so it just sends json no matter what you request.
Probably, but most modern JSON APIs define different JSON structures as different mime-types:

For example, they might use application/vnd.foo and application/vnd.bar on the same end-point.
>>
>>62162478
>You're fundamentally using makefiles wrong.
### Functions ###
range = $(if $(filter $1,$(lastword $3)),$3,$(call range,$1,$2,$3 $(words $3)))
make_range = $(foreach i,$(call range,$1),$(call range,$2))
equal = $(if $(filter-out $1,$2),,$1)


### Variables ###
limit := 101
numbers := $(wordlist 2,$(limit),$(call range,$(limit)))

threes := $(wordlist 2,$(limit),$(call make_range,$(limit),2))
fives := $(wordlist 2,$(limit),$(call make_range,$(limit),4))

fizzbuzz := $(foreach v,$(numbers),\
$(if $(and $(call equal,0,$(word $(v),$(threes))),$(call equal,0,$(word $(v),$(fives)))),FizzBuzz,\
$(if $(call equal,0,$(word $(v),$(threes))),Fizz,\
$(if $(call equal,0,$(word $(v),$(fives))),Buzz,$(v)))))


### Target ###
.PHONY: all
all: ; $(info $(fizzbuzz))

>>
>>62162478
This triples the amount of code, which is already humongous.

Also, the .cfg files contain paths to image files, which are part of the source. How would you deal with that? Parse .cfg files in the makefile (is that even possible) to extract the paths?

I'm using make to accelerate level building, because my previous Python script built all levels, which started taking a while (~30s), and used only 1 core, so it fits my purpose and the purpose make was built for (to decrease build times).
>>
>>62162509
Hmm, any way to determine what they support? Would it just be in the API documentation usually? The 4chan API doesn't specify any content types so I figured application/json, but I noticed github API says to use some json variant in the accept field.
>>
File: 1.png (379B, 39x25px) Image search: [Google]
1.png
379B, 39x25px
>>62162545

lvl1
IMAGE_PATH=rsc/1.ppm
BACKGROUND_COLOR=1;1;1
ROTATION=0.0
PULSATOR_IDLE_STATE_TICKS=49
PULSATOR_ACTIVE_STATE_TICKS=6
>>
>>62162554
>Hmm, any way to determine what they support?
Modern well-formed CRUD APIs should offer some sort of API descriptor. It's been a while since I've done webdev though, but there are plenty of guides online how to make proper service discovery.

>Would it just be in the API documentation usually?
It should be.


>The 4chan API doesn't specify any content types so I figured application/json, but I noticed github API says to use some json variant in the accept field.
I'm not sure about 4chan, but I suspect that it might not respect accept headers. I could be wrong, it's always possible to capture traffic in the regular 4chan interface or already existing 4chan clients.
>>
>>62162545
>This triples the amount of code
No it doesn't. Those rules only need to be written once.

Overall, it would look like
rsc/%.lvl: rsc/%.cfg
./lvlgen.py < $< > $@

rsc/%.frames: rsc/%.cfg
./flgen.py < $< > $@

rsc/%s.frames: rsc/%.cfg
./sflgen.py < $< > $@

lvl0: rsc/0.lvl rsc/0.frames rsc/0s.frames
lvl1: rsc/1.lvl rsc/1.frames rsc/1s.frames
...

However, if you weren't using phony rules and was actually generating some file, it could be
rsc/%.lvl: rsc/%.cfg
./lvlgen.py < $< > $@

rsc/%.frames: rsc/%.cfg
./flgen.py < $< > $@

rsc/%s.frames: rsc/%.cfg
./sflgen.py < $< > $@

lvl%.something: rsc/%.lvl rsc/%.frames rsc/%s.frames
# Or something actually useful
cat $? > $@
>>
>>62162615
Pretty sure he needs phony rules since levels depend on pictures linked to inside those cfg files. He'd either need a script to generate dependencies, or he needs to remake all levels every time he runs make, which is what he is doing.
>>
>>62162615
What's the point of listing most of dependencies when some dependencies are still not included and the build targets won't be built when those not included dependencies will be changed?

I'm talking about the image files like >>62162558
>>
>>62162639
Or I could scrap my filter design and generate files like this:

lvlgen.py ./rsc/0.cfg ./rsc/0.ppm > ../rsc/0.lvl


but I'm not sure I've got enough will power to do that. I'm rewriting this for the third time now. This could be worth it though, since I plan on making a lot of sequels to this and thus expand to be a relatively huge game.
>>
>>62162615
>>62162639

Also, phony rules are GNU make extension, non-compatible with POSIX make.
>>
>>62162640
>What's the point of listing most of dependencies when some dependencies are still not included and the build targets won't be built when those not included dependencies will be changed?
Make is fundamentally about making a file from a list of other files, or its dependencies.
If you don't list your dependencies, Make has no idea if it needs to rebuild something, or will rebuild something it doesn't need to. You have to be explicit for what is needed to generate each file.

If you don't do this properly, you're going to be losing the advantages of actually using make in the first place, as opposed to just writing a shell script or some shit.
>>
>>62156879
>Programs shouldn't get better after 1.0

Ooookaaaay
>>
>>62162712
You can write phony rules in "normal" POSIX make. You just won't mark it as such.
>>
>>62162735
Well, here's where I've gotten it:
https://stackoverflow.com/questions/2278151/how-similar-different-are-gnu-make-microsoft-nmake-and-posix-standard-make

>The interpretation of targets containing the characters '%' and '"' is implementation-defined.
>>
>>62162752
A phony rule is just a rule which doesn't actually generate a file with its rule name (e.g. make all, make clean). You can write that anywhere.
The GNU .PHONY just marks it as phony, so it will treat it slightly differently.

The pattern rules (%) are a GNU extension, though.
Really, POSIX make is ridiculously limited. Just target GNU make, or some BSD make if you're one of those sorts of fags. It's portable enough.
>>
>>62162781
i hope one day bash and make and other obscure shit are replaced by haskell & haskell libraries
>>
>>62162781
>Just target GNU make, or some BSD make
Why add additional complexity to the build system where there is no need?

>>62162810
>>obscure
>changing obscure software with even more obscure software
Make is literally more widely deployed than Haskell.
>>
What does dpt think of Oberon?
>>
>>62162684
I think you can easily do the first code segment that other anon posted in >>62162615.

lvl%: rsc/%.lvl
echo lvl%

rsc/%.lvl: rsc/%.cfg
./lvlgen.py < $< > $@

rsc/%.frames: rsc/%.cfg
./flgen.py < $< > $@

rsc/%s.frames: rsc/%.cfg
./sflgen.py < $< > $@

all: lvl0 lvl1 lvl2 .......... lvl50
>>
>>62162822
yes, I'm saying it would be better for make to be Haskell (language) + some make library than for it to be its own thing
>>
>>62162829
I've literally never heard of it, and I have no interest it looking it up.
>>
>>62162836
I'd love to have make functionality as an easy to use library in a good programming language, but Haskell isn't it.
>>
>>62162845
What's wrong with Haskell?
You can use free monads to make a nice make api
>>
>>62162836
lol no. Imagine your employee telling to learn Haskell (no authoritative standard organization, just some fanboy document) vs POSIX make (one standard POSIX page + macro page) for a simple build system and the costs associated with both.
>>
>>62162844
I wasn't asking children.
>>
>>62162855
Used nomads 50% off. Thanks.
>>
>>62162857
No, you'd have a bunch of stuff in Haskell, make is just one example.
Make would just be a library then.
>>
>>62162855
what is a monad
what is a higher order fucntion
you have until the next thread starts to explain
if u cant do it in time haskell sucks
>>
>>62162829
I like the idea of a simple clean language, but it's a failed attempt so there's no reason to waste time on it.
>>
>>62162866
Take you reddit flavour-of-the-week shit elsewhere, fag.
>>
>>62162868
A bunch of other shit nobody will ever use and will only rise the hiring costs. No, fuck Haskell, it's irrelevant. It was born too late.
>>
>>62162872
a higher order function is a function taking another function as a parameter

a monad is a monoid in the category of endofunctors
>>
>>62162887
>a monad is a monoid in the category of endofunctors
what is monoid
what is endofunctors
>>
>>62162887
whats an endofunctor
same rule applies
>>
>>62162887
>a monad is a monoid in the category of endofunctors
I don't understand any of these two terms.
>>
File: Nico 309.png (200KB, 752x1062px) Image search: [Google]
Nico 309.png
200KB, 752x1062px
>>62162887
>a monad is a monoid in the category of endofunctors
>>
File: what's the problem.png (8KB, 225x235px) Image search: [Google]
what's the problem.png
8KB, 225x235px
>>62162892
>>62162896
>>62162906
>>62162908
>>
New thread:

>>62162915
>>62162915
>>62162915
>>
>>62162917
What color-scheme is this?
>>
Probability of Python 3 becoming an ISO standard?
>many supported platforms
>widely used and deployed
>multiple major implementations (CPython, IronPython, Jython and PyPy)
>multiple cpython variants
>multiple sub-set implementations (Brython, CLPython, HotPy, pyjs, PyMite, pyvm, RapydScript, SNAPy, tinypy)
>multiple implementations in progress (Berp, phpython, Pyjaco, Pystacho, pyvm2, Skulpt, Typhon)
>shitload of libraries and frameworks
>many working products made
>>
>>62162927
Whatever lainchan uses
>>
>>62162949
0/0
>>
>>62162971
It's undeterminable?
>>
>>62162987
It's an exception.
>>
>>62163036
Probability of Python 3 becoming a standard is an exception?
>>
File: vmware_2017-08-30_13-20-09.png (32KB, 717x263px) Image search: [Google]
vmware_2017-08-30_13-20-09.png
32KB, 717x263px
>>62163047
>>
>>62162949
Very unlikely.
>>
>>62156754
D's not dead
Thread posts: 330
Thread images: 33


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.