[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: 322
Thread images: 40

File: parametric.png (616KB, 680x954px) Image search: [Google]
parametric.png
616KB, 680x954px
What are you working on, /g/?


Previous Thread: >>59486363
>>
pointer to a template
template t;
template* u = &t;
>>
>>59490639
>* u
>>
>>59490651
*template* * *u == &*&*&*&*t&t*t&(T : t)|t;
>>
int
a = 0;
int
b = 1;
size_t c = 0;
writeln(a - b + c); //18446744073709551615


Some of you guys are okay. Don't go to Dconf tomorrow. Rust was always right.
>>
File: anime.png (786KB, 1000x1300px) Image search: [Google]
anime.png
786KB, 1000x1300px
obligatory apology for not using an anime image


functional programming thread: >>59453249
stupid questions thread: >>59487792
wdg thread: go here instead >>59490668
temple OS thread: >>59487706
friendly gnu/linux thread: >>59478933
>>
>>59490667
Next time you see a D fag bitching about how correct D is show him this. Literally not even c.ancer has this problem.

t. D fag myself
>>
>>59490616
rust > everything else
>>
what kind of code is this?

https://streamable.com/yftjo
>>
>>59490709
C
>>
>>59490709
>fixing crippling bugs
C
>>
>>59490709
what show is this?
>>
>>59490732

homeland
>>
>>59490667
Any language that isn't weakly typed trash would allow this.
>>
File: Bane.jpg (37KB, 615x409px) Image search: [Google]
Bane.jpg
37KB, 615x409px
Best resources for learning about time complexity and creating/moving through heap based data structures on Java?
>>
JS fags wishing they were programming in Haskell
https://medium.com/javascript-inside/an-introduction-into-lenses-in-javascript-e494948d1ea5

Discussion: are lenses better suited for statically typed or dynamically typed languages?
>>
>>59490806
lenses are better suited for some blind nigger's glasses

do languages typed with a keyboard

i put code directly on the stack
we're working right on the bare metal
implementing new core lang utils 20 times per second per second

instantiating truly massive structs

you don't know my code
you don't know my code
>>
>>59490838
>putting code on the stack
MIT nigger
>>
>>59490882
i do core dumps
i figured out how to read a core dump

nobody in the history of the world was able to read a core dump and understand it
i taught myself how to decipher these core dumps

there is much knowledge to be gained from reading old core dumps

core dumps may yet reveal the secrets of ancient atlantean monad space cyber droids

the first civilization left these core dumps to us in good faith
>>
>>59490902
Can I get a quick rundown of the ancient atlantean monad space cyber droids?
>>
>>59490902
hey doc, what does it mean if my core dump has red in it?
>>
>tfw can't program anything cool and unique because all creative programming ideas are way too difficult to program

feels bad man
>>
functionName :: a -> b

What do I win?
>>
>>59491000
Cool and Unique stuff don't require complex programming. I mean facebook wasn't hard to program. Coming up with the idea is another thing.
>>
>>59491046
>tfw not an idea guy
>>
>>59491065
Well well well I happen to be an idea guy
>>
>>59491068
hear one of your ideas
>>
>>59491083
They aren't for free goyim
>>
>>59491035
>no definition
>can't be meaningfully defined without infinite non-productive recursion
>>
>>59491088
how many shekels?
>>
>>59491113
1000 souls
>>
In Haskell this is just
include Monad;
>>
>>59491210
Have you ever considered actually learning Haskell?
>>
>>59491243
I am the Haskell MASTER

FEAR my Monads and purity.
>>
>>59491247
https://en.wikibooks.org/wiki/Haskell
>>
>>59491262
in Haskell this is just
include Monad.Wikibooks.Monad;
>>
>>59491265
Useless.
>>
>>59491276
You're just jealous because you don't know how to program Elon Musk's top-secret Martian death laser array in Haskell

PROTIP: In Haskell, you would just include a Monad for it.

Stay braindead and cucked, you pathetic low-IQ low-test C++ cuck.
>>
>>59491288
Why do you hate Haskell so much?
>>
>>59491290
Why would you even imply such a thing?
I love Haskell! It's the best programming language to do anything and everything everywhere and everywhen for everywhy, for ever and ever and ever and ever and ever and ever, and you are a braindead idiot brainlet cuckbrained jew-brainwashed cuck if you think otherwise. Your pathetic jewish cuck C++ is impure, and riddled with toxic side-effects. It doesn't even have a Monad!

How can you possibly hope to ever program anything non-trivial without a Monad?
>>
>>59490667
>Hur dur I'm retarded
>>
>>59491303
Are you a lonely person?
>>
>>59491333
I'm a Monad. I'm pure. I've got no side effects.
>>
File: IMG_0299.jpg (1MB, 3264x2448px) Image search: [Google]
IMG_0299.jpg
1MB, 3264x2448px
>>59490794
>>
>>59490919
Your shitpost actually ended up in that twitter hahahaha
>>
>>59490616
globale      
form est un formulaire, titre vaut "La boite à texte", largeur vaut 400, hauteur vaut 260
boite est une boite,x vaut 30, y vaut 30, largeur vaut 200, hauteur vaut 100
b1 est un bouton, texte vaut "Afficher le texte dans le tableau", x vaut 30, y vaut 150
l1 est une étiquette, texte vaut "", x vaut 30, y vaut 200

principale :
début
ajoute boite & b1 & l1 dans form
Fais réagir b1 à "clic souris" pour afficher valeur
tant que 1 != 2, lis
temporise
ferme

afficher valeur :
*b est un bouton
début
affiche texte de boite
reviens
>>
>>59491621
and they say programming languages only exist in english

get eternally BTFO, you gay millennial SJW /g/ cucks
>>
If I have example.com and example.com/testpage do both of these normally share the same ip or different ip for each page?
>>
>>59491699
Resolve it using the IP Monad (Haskell)
>>
>>59491699
The same.

>>59491709
How do I use the Shitposting Monad?
>>
>>59491714
You're already using it.
>>
File: IMG_4198.png (22KB, 370x320px) Image search: [Google]
IMG_4198.png
22KB, 370x320px
>>59490651
>He puts the star next to the name in a declaration
>>
>>59490616
I want to make a login for my website. I know php already, and have made logins in that, but fuck php. What language is the superior one for this purpose?
>>
>>59491766
who is this lass and why are her eyes blue
>>
>>59491768
Python. No memes.
>>
>>59491775
Luluco's eyes are blue because we love her and accept her for who she is, anon.
>>
am i stupid or does my pattern matching function not work

i wanna find this
F3 44 0F10 15 03319400
45 84 ED
0F84 D0010000
0F28 4B 70
F3 0F10 25 92309400
F3 0F10 1D 6A309400

shouldn't my mask be
xxxx?????xx?xx????xxxxxxxx????xxxx????

or at least
x?xx?????xx?xx????xxxxxxxx????xxxx????


I'm trying to find
0F84 D0010000        
btw way

It works if I leave out the first instruction but then there are false positives for other app versions.

x86_64 btw
>>
New to C++, can someone explain to me the need for virtual functions?
>>
>>59491800
they should be red
red eyes are cuter

fight me
>>
Why does this give me a stack error. I don't get it. Is there some secret to understanding pointers.

#include <iostream>
#include <fstream>
#include <string>

void read(int testCases, std::string *lenOfStr, std::string *inStr)
{
std::ifstream myFile("Magical_Word.txt");
myFile >> testCases;

lenOfStr = new std::string[testCases];
inStr = new std::string[testCases];

int iter = 0;
while(myFile)
{
myFile >> lenOfStr[iter];
myFile >> inStr[iter];
iter++;
}

myFile.close();
}

int main()
{
int testCases;
std::string *lenOfStr;
std::string *inStr;

read(testCases, lenOfStr, inStr);

std::cout << lenOfStr[0] << " " << inStr[0] << " " << testCases << std::endl;

delete [] lenOfStr;
delete [] inStr;

return 0;
}
>>
>>59491823
Virtual functions allow for polymorphism.
>>
>>59491823
It's just a sort of run-time polymorphism. You should avoid them if you can tho, parametric polymorphism via templates is better because of monomorphisation.
>>
>>59491858
Why can't you just polymorph them or overload them before you compile?

>>59491906
I get that but can you explain when would one use such a thing.
>>
>>59490616
I remade Go channels in der Ecmascriptzen.

>tfw you make a prototype so you can make a prototype so you can make a prototype
>>
Has anybody here tried to do something in UWP? The UI looks nice and getting it onto the windows store seems like a must but adapting to the new xaml is not fun at all.
>>
It still seems like every somewhat big c++ project team ends up writing their own stl at some point
>>
>>59492132
>UWP
Don't be a cuck.
>>
>>59491849
you need to pass the address of a pointer variable to function to alloc memory


int foo( int ** a )
{
*a = malloc(...);
}

main()
{
int *a;

foo(&a);
}
>>
>>59492219
memes~

captcha: place mexico
>>
>trying to learn android bound services for an IPC to identify finger prints so I can have an array of apps sharing a finger print pass/user
HELP
>>
File: 1387146575750.jpg (22KB, 304x304px) Image search: [Google]
1387146575750.jpg
22KB, 304x304px
>My post showed up on /dpt/.txt
>>
Just got my master thesis project the thing is I told them I know C++ pretty much as well as my dick knows the palm of my right hand, while I infact know shit except that it's shit. So /dpt/ I need a /quickrundown/ on the main components of the language so I can bullshit my way through this somehow
>>
File: ars_longa_vita_brevis.png (152KB, 744x638px) Image search: [Google]
ars_longa_vita_brevis.png
152KB, 744x638px
>>59492260
>>
>>59492242
mine too! congrats to us
>>
File: tmp_6194-14894373515961045670373.jpg (322KB, 1280x720px) Image search: [Google]
tmp_6194-14894373515961045670373.jpg
322KB, 1280x720px
>>59492242
>mfw my POSTS showed up in /dpt/.txt
>>
>>59492322
I've had posts on there before. It was literally years ago, so looking back, I can't remember which ones were mine.
>>
>>59492225
I ended up doing this. But thanks for the input, I tried that as well but it ended up getting messy.

#include <iostream>
#include <fstream>
#include <string>

void read(int &testCases, std::string *&lenOfStr, std::string *&inStr)
{
std::ifstream myFile("Magical_Word.txt");
myFile >> testCases;

lenOfStr = new std::string[testCases + 10];
inStr = new std::string[testCases + 10];

int iter = 0;
while(myFile)
{
std::cout << iter << std::endl;
myFile >> lenOfStr[iter];
myFile >> inStr[iter];
iter++;
}

myFile.close();
}

int main()
{
int testCases;
std::string *lenOfStr = NULL;
std::string *inStr = NULL;

read(testCases, lenOfStr, inStr);

delete [] lenOfStr;
delete [] inStr;

return 0;
}
>>
Humans are truly the worst programmers to ever live. We should have our code managed by a superior animal, such as a squid, or an octopus.
>>
>>59492260
Learn stage Hypnosis, use it to put anyone "under" that you need to convince you know C++
I think that is your only reasonable option.
or this...
>>59492278
>>
>>59492378
You're trying too hard.
>>
>>59492411
No such thing. Fuck off, cuck.
>>
>>59492357
I am confused by this. What are you trying to do? Why allocing memory in the first place?
>>
>>59492425
I call malloc...
>>
I/O is a side effect. It's impure. We need to get rid of it. The only pure programming is programming without I/O.

The Monad knows no I/O.
>>
>>59492357
> *&
You're doing something wrong.
>>
>>59492448
The "no I/O meme" is over.
Shut up.
>>
>>59492471
Fuck off, C++ cuck.

C++ more like STD::infected
>>
>>59492487
I vehemently hate C++.
Nothing in my post implied otherwise, you meme spouter.
>>
Why the fuck aren't Rust strings null terminated?
It makes FFI'ing with C much more painful.
>>
>>59492496
>everyone who disagrees with me is meme spouter, because I said so
Nice argument, Cuck++.
>>
>>59492509
String termination was a mistake in C
>>
File: iwouldhaveslaughteredyou.jpg (68KB, 800x587px) Image search: [Google]
iwouldhaveslaughteredyou.jpg
68KB, 800x587px
>>59492509
>Null-terminated strings
>>
Trying to implement Dijkstra's algorithm for Project Euler

Quick question though, if I have an index Struct, how would I write the "<" operator such that I can iterate through all the points in a grid?

Right now, I'm having the issue that the set thinks different points are actually the same point and so doesn't add them... How do I get around this?

struct Index
{
int col, row;
Index( int c, int r): col(c), row(r) {}

friend ostream& operator<<(ostream& out, const Index& ind)
{
out << "(" << ind.col << ", "<< ind.row << ")";
return out;
}
};
bool operator < (const Index& x, const Index& y)
{
return x.col < y.col && x.row < y.row;
}
int main()
{
std::set<Index> indSet;
Index a(0, 0), b(1, 0);
indSet.insert(a); indSet.insert(b); //the set "absorbs" one of the points... I think my < operator sucks
cout << indSet << endl;
return 0;
}



Output:
 {(0, 0),     }
>>
>>59492509
Just use std::ffi::CString
>>
>>59492509
Because they actually care about performance and safety and have to reason to repeat 50yo hacks.
>>
>>59492534
EPIC ECKSDEE
>>
File: 1446332804490.png (328KB, 672x706px) Image search: [Google]
1446332804490.png
328KB, 672x706px
>>59492522
>>59492523
>>59492538
>He's too stupid to handle something as simple as null terminated strings
I would never trust anything you program, no matter what language.
>>
I know that you aren't supposed to use
using namespace
in your header files, but what about using them in your cpp files (in a public library)?
>>
>>59491849
>allocating std::strings on the heap with new

disgusting
>>
why does /g/ push this meme that japanese women are good at programming

did the jews cuck /g/ with the yellow fever meme?
>>
>>59492544
t. CAI agent looking for 0-days
>>
>>59492522
>>59492523
Whether it's a bad idea or not, it doesn't fucking hurt to pop a little null byte at the end of strings in order to make interfacing with C much easier. I'm not telling you to fucking stop using sized strings or anything, just do the same thing that std::string does in C++.
Rust is supposed to be a fucking systems programming language after all.

>>59492534
How the fuck does adding a null byte have any effect on elegance at all?
If anything, it makes it more elegant by making C FFI code much cleaner.

>>59492535
>All this bloated unnecessary shit just to add a null byte where there should already be one

>>59492538
A single null byte at the end of strings has literally zero effect on both performance and safety.
I never implied that they should stop using a size field, I'm just saying they should maintain the fucking null byte in order to be compatible with the languages it claims to be able to work with.
>>
>>59492565
The people portrayed in anime are actually white people.
>>
>>59492534
Fucking idiot
>>
>>59492572
>Rust is supposed to be a fucking systems programming language after all.

Being a systems programming language does not mean blindly copying C.
>>
>>59492525
Okay, I found some solution... How much of a bad idea is this?

    friend bool operator==(const Index& lhs, const Index& rhs)
{
return (lhs.col == rhs.col && lhs.row == rhs.row);
}
bool operator < (const Index& x, const Index& y)
{
cout << !(x==y) << endl;
return !(x==y);
}

(apparently, elements in a set are equal if x < y evaluates to false)
>>
>>59492525
>>59492597
How on earth do people defend this language?
>>
>>59492594
Did you even read my post at all?
It's not blindly copying C, it's called being able to interface with C much easier.
Null terminating strings does not affect the rest of Rust in any way whatsoever.
>>
>>59492572
> a little null byte at the end of strings in order to make interfacing with C much easier
Just use ffi::CString, it's exactly what you want, there is no need to drag legacy bullshit into the base standard library, Rust isn't C++.
>>
>>59492583
then why do they have japanese names
why do they live in japan
why do they do japanese culture
why do they always have these japanese physical traits; straight hair, slanted monolid eyes, no freckles, long limbs

how are they white
is this some "japanese are honorary aryans" bullshit
how are these people genetically indo-european to the fucking slightest
they're pale-skinned japoids is what they are
they're japs that moved too far north and spent too much time indoors
>>
>>59492613
>ffi::CString
Inefficient SHIT.
I thought Rust was supposed to be efficient?
>>
>>59492608
>>59492594
Stop arguing over trivial things
>>
>>59492619
>straight hair, slanted monolid
What? I don't think you've watched any anime at all.
>>
File: cstring.png (13KB, 832x184px) Image search: [Google]
cstring.png
13KB, 832x184px
>>59492621
How is it inefficient? It's literally just an owned null-terminated string, it's as efficient as any C string.
>>
I know it's not safe to
using namespace std;
in C++, but is it safe or at least not bad practice to
use std::*;
in Rust?
>>
File: 133137121242.jpg (63KB, 489x629px) Image search: [Google]
133137121242.jpg
63KB, 489x629px
>>59492633
WHY does the door not open?
why are you FUCKING trolling me?
>>
>>59492648
Wildcard import is a bad practice in all languages.
>>
>>59492648
I don't think you understand the point of memespaces.
>>
>>59492646
>Box
>HEAP ALLOCATED
>"""EFFICIENT"""
Compared to a simple null terminated const char * in static memory? AAAHAHAHAHAHAHAHA don't make me fucking laugh.
You're going to be heap allocating a string JUST TO FUCKING ADD A NULL BYTE every fucking time you call the function.
DISGUSTING
>>
>>59492646
What font is this?
>>
>namespaces
In Haskell, this is just
include Monad.Namespace.Monad;
include Namespace.Std.Namespace;
let;
do;
end;
>>
>>59492664
Excuse me?
>>
>>59492670
Why yes I do. Assuming I won't have any conflicting symbols, please explain why I should refrain from using it.
>>
>>59492648
Safe, but bad practice. If you intend for something to be wildcard imported, create a prelude to be used like
use mylib::prelude::*;
>>
>>59492703
If you wildmeme import all of the memes, you will get meme conflicts, and may as well not have memed at all.
By the way, did I tell you I think namespaces are a meme feature?
>>
if namespaces aren't supposed to be used

why did they put them in the standard?

ha, checkmate you dumb /g/ cucks. get trolled. get owned.
>>
>>59490616
Suggest me a simple no-nonsense style guide for C Language. I want to develop good habits from the start.
>>
>>59492685
There is no need to be hysteric, m8. I assumed you want owned string so I suggested ffi:CString.
If all you need is a null-terminated string in static memory you can just use &'static [u8], and you even can use null-terminated string literals with b"Hello world\0".
>>
>>59492703
It is safe, it is a compile-time error if something is ambiguous:
mod foo {
pub struct Baz(pub u8);
}

mod bar {
pub struct Baz(pub char);
}

use foo::*;
use bar::*;

fn main() {
let _ = Baz(0);
}


When trying to compile:
rustc 1.16.0 (30cf806ef 2017-03-10)
error: `Baz` is ambiguous
--> <anon>:13:13
|
13 | let _ = Baz(0);
| ^^^
|
note: `Baz` could refer to the name imported here
--> <anon>:9:5
|
9 | use foo::*;
| ^^^^^^^
note: `Baz` could also refer to the name imported here
--> <anon>:10:5
|
10 | use bar::*;
| ^^^^^^^
= note: consider adding an explicit import of `Baz` to disambiguate

error: aborting due to previous error
>>
>>59492735
2 projects with same namespace name
if both used project_fn there would name clash. With namespaces you can rename the namespace and avoid clash.

But because sepples tards are the worst people on the world they will over abuse any feature just because it exists.
>>
>>59492744
>I want to develop good habits from the start.
Ditch C, it has close to 0 uses these days
>>
>>59492744
https://www.kernel.org/doc/Documentation/process/coding-style.rst
Just ignore the stuff specific to the Linux kernel.
>>
>>59492748
>Explicit null termination
Also disgusting.

What if you want to pass string literals that are not guaranteed to be null terminated?
>>
I need to make a search using VBA in Excel on this site: https://echa.europa.eu/search-for-chemicals

So I verified for the name of the search box via inspect and it is "disssimplesearch_WAR_disssearchportlet_sskeywordKey"
I'm trying the input:
"https://echa.europa.eu/search-for-chemicals?disssimplesearch_WAR_disssearchportlet_sskeywordKey=" where a CAS no or something will be entered to be searched by the used but it doesn't work. (I'm aware that after a search is performed, the link doesn't contain anything specific to the search itself)

How can I get it to allow a search through the address bar?
>>
>>59492768
>string literals that are not guaranteed to be null terminated
Well then they are not fucking string liters stupid nigger.
>>
>>59492777
What if they are string literals from another library?
What if they came from a String?
Strings in Rust are not guaranteed to be null terminated, and most of the time they aren't.
>>
>>59492766
But anon, it enforces good programming practices. Many languages are influenced by C which makes them learning easier.
And, I'm a MechE actually. I just want to utilize my free doing something productive. My goal is to learn C++ afterwards.
>>59492767
Thank you
>>
>>59490667
how to be a gay mush head: the post
>>
>>59492796
>My goal is to learn C++ afterwards
Don't bother: it's shit.
>>
>>59492768
Well then you have to allocate a CString expicitly. But in this case you would be doing something wrong.
I don't get what's your problem, Rust isn't C and it doesn't have to support all the quirks with zero-cost. Adding 0 to all strings by default just because there's a slight possibility the string will be used with C FFI is just stupid and inefficient.
>>
>>59492796
>it enforces good programming practices
What
>>
>>59492810
>slight possibility
large possiblilty*
>>
>>59492796
Start with C++, seriously. You don't have to know C to start with C++, and many things in C are basically deprecated in C++.
>>
>>59492821
> large possiblilty
[citation needed]
>>
File: 1452471092796.png (372KB, 1280x720px) Image search: [Google]
1452471092796.png
372KB, 1280x720px
>>59492831
>Actually recommending C++ to anyone for any purpose
I wouldn't wish to inflict that horror on even my worst enemies.
>>
>>59492831
this. modern C++ is underrated
>>
>>59492846
The fact that pretty much everything in Rust goes through an FFI at some point.
>>
>>59492849
C is the true cancer, anon. Stop spewing bullcrap memes.
>>
do you even lift?

https://wiki.haskell.org/Lifting
>>
>>59492858
I didn't bring up C.
C++ is just a fucking awful language. It's an absolute clusterfuck of random features piled on top of C to somehow make it "better".
There is no unifying design. There is no direction. There is no elegance.
C++ is what you get when you put a million monkeys in a room and get them to design a programming language.
>>
>>59492807
According to /g/entoomen, everything is shit.
>>59492814
It's strongly typed language, makes you decide everything beforehand. You work closer to machine and makes you understand many basic things about memory like pointers.
>>59492831
Guess I'll have to reconsider then. Probably anything by Bjarne Stroustrup goes, so I wouldn't ask where to start. But, anyway if you have any better recommendation, please suggest me.
>>
>>59492895
>C is a strongly typed language
Anon, I ...


In fact why is C so over rated?
>>
>>59492882
Still incredibly efficient and used by millions across the world for high performance applications.

But sure anon keep spreading your opinion, everyone really cares to hear it
>>
>>59492914
you just did
>>
>>59492895
>It's strongly typed language, makes you decide everything beforehand
The word you're looking for is "statically" typed.
C is not strongly typed. You can give the middle finger to the type system if you want to.

>>59492914
>Argumentum ad populum
Good one.
>high performance applications
>Doesn't even have restrict pointers
>Claims to be high performance.
>>
File: 1431828492419.gif (113KB, 210x360px) Image search: [Google]
1431828492419.gif
113KB, 210x360px
I was bored a couple of months ago so I picked up programming. Right now, I only know Java and a bit of Python. What's a good language to learn next?

Also, I've read through CLRS and another algo book I randomly picked up (KT, I think?) Any good books to read next?
>>
>>59490616
Trying to figure out how to best formulate a pipe that constructs and evaluates subpipes in a monadic context.
It would sound like an autistic brag if I wasn't so fucking confused on how to implement it in a sensible way..
>>
>>59492965
try D
>>
>>59492932
Just looked the difference here: http://stackoverflow.com/questions/1517582/what-is-the-difference-between-statically-typed-and-dynamically-typed-languages
Now, I understand what does statically typed language means.
>>
File: 1453303583505.jpg (41KB, 429x377px) Image search: [Google]
1453303583505.jpg
41KB, 429x377px
>>59492971
>Recommending Deadlang
But why?
>>
>>59492992
Languages are not alive
>>
#include <stdio.h>
//compiles without warnings
void *main( void *argc, void **argv ) {
for( void *i = (void *) 0; i < (void *) 5; i++ ) {
printf( "%p\n", i );
}

return (void *) 0;
}
>>
>>59492992
What do you suggest, then?
>>
>>59492853
But not all FFI take null-terminates string tho. For example, read/write syscalls take pointer+length, and they're like 50% of all FFI you need.
>>
>>59492997
If they were, D would definitely be one of the deadest.

>>59493000
>//compiles without warnings
Maybe you should try turning them on, then?

>>59493004
I don't know what you want to do. Learning C would probably be good for you, even if just to give you a healthy understanding of lower level programming.
>>
>>59492965
Try Haskell, it's not very practical per se, but it's a good language to widen your horizon and teach youself some new things.
>>
>>59493031
>C
Stopped reading right there. Fuck off and take your shitty languagelet with you
>>
>>59492565
Who is /g/? Some new namefag?
>>
>>59493031
If they were, D would definitely be one of the deadest.
How can languages have "lives"? I like fan fictions.
>>
File: 1374577775522.jpg (3KB, 125x126px) Image search: [Google]
1374577775522.jpg
3KB, 125x126px
>>59493053
>Your computer is running C code _right now_
>>
>>59493072
>Codes run
This is your tiny little brain on C
>>
>>59493072
>be a dumb weeb
>be a dumb C tard
what's left?
>>
>>59493078
>>Codes run
What?
>>
>>59493052
How can a language be "practical"?
>>
>>59493084
You said my computer is running "C codes". Do you suffer from low attention span?
>>
>>59493072
>>59493078
>>59493081
Who said that?????
>>
>>59493085
Well I meant to say it won't get you a job.
>>
>>59493090
There is no 's' at the end of 'code'.
Can you not read?
>>
>>59493072
>computer is running C code
Thanks for the cringe
>>
How often do 2-3 trees come up in interviews?
>>
>>59493105
Oh so you are both dumb and illiterate. Nothing surprising from your typical C tard
>>
File: 1441085098990.png (42KB, 512x323px) Image search: [Google]
1441085098990.png
42KB, 512x323px
pls stop fighting i was just asking for a nice language to learn
>>
>>59493108
And here I thought C tards know "low level" programming
>>
>>59490616

I'm making an application that runs its backend with EFCore pointing to SQLite to be consumed from UWP, CLI on Linux/OSX and WPF. Later I want to migrate it to ASP.Net MVC Core or 5 and run the database on a web server of some description.

dotnet cli's pretty cancer but apparently I have to use it to migrate my dirtfeeding Json to glorious masterrace csproj XML files because MS is cancer.
>>
>>59493072
It's not. I use only Haskell and x86 assembly.
>>
>>59493135
fite me mate i no binary
>>
>>59492906
because it's simple and any brainlet can learn it. you can learn most of the syntax in an hour.
>>
>>59493116

never.

My interview was to pick an index out of a list where the element satisfied some silly sort condition. My second interview was to answer database questions and a linq query that spat out a dictionary from some data I had
>>
File: 1489530656576.jpg (49KB, 600x381px) Image search: [Google]
1489530656576.jpg
49KB, 600x381px
>>59493149
I guess so. C is a newbie friendly toddler toy language designed for people that can't read a book with more than 200 pages.
>>
When I use getElementsByClassName in Javascript, it's not getting any results.
What do?
>>
>>59493163
Are you implying that C(ancer)++ is somehow better than just C(ancer)?
>>
File: 1489548136608.jpg (832KB, 3264x1836px) Image search: [Google]
1489548136608.jpg
832KB, 3264x1836px
>>59493163
>>
>>59493173
At least it attempts to be the better one but fails due to the compatibility with 'c'
>>
>>59493169

Do the callback after the DOM loads, not before.
>>
>>59493190
C++ fails on basically every level.
>>
>>59493194
Only because it didn't sever the baggage of 'c'
>>
>>59493192
How do I do that, and what's the DOM?
>>
>>59493201
Anything with even slight hints of POO has failed from the get go. The C baggage just makes it worse.
>>
Daily reminder C(ancer) is the stale meme and we need new fresh weekly meme
>>
>>59493228
C(ommunism)
>>
>>59493236
stale
>>
>>59493228
C(OBOL)
>>
File: 1483243843078.png (50KB, 255x204px) Image search: [Google]
1483243843078.png
50KB, 255x204px
>>59493194
Explain this not using meme terms.
>>
>>59493228
>>59493251
>meme xD
>>>/r/ibbit
>>
>>59493194
>If I say it sucks for long enough someone may actually believe it
>>
>>59493281
Spotted the angry C tard, go back to your remaining 43 undefined behaviors that needs fixing.
>>
>>59492597
>not implementing a deep compare that works with any type
>>
>>59493313
>post-SJW
Stopped reading right there.
>>>/r/ibbit
>>>/t/umblr
>>
File: 1489880434820.jpg (147KB, 2038x1505px) Image search: [Google]
1489880434820.jpg
147KB, 2038x1505px
>>59493281
>>59493313
>Codes "run"
>>
File: Girls.png (490KB, 449x401px) Image search: [Google]
Girls.png
490KB, 449x401px
>>59493313
>he's a white straight man(male) writing in C
>>
>>59493361
This isn't a full image.
>>
>>59493361
The C, C++ and rust guts all have their willies out and are getting deep fisted
>>
>>59493202
You're kidding right? Do you even have any basic understanding of Javascript?
>>
How do I use Javascript to insert something as a child of an image?
I'm trying to insert a string with appendChild but it's complaining it's not an object.
>>
File: eVrQq3lE4Io.jpg (34KB, 565x365px) Image search: [Google]
eVrQq3lE4Io.jpg
34KB, 565x365px
>>59492965
> couple of months ago I picked up programming
> I know Java
>>
>>59493361
post the uncropped version :^)
>>
We severely need other paradigm of /dpt/logy
We make /oopt/ for Java, C#, Rust and C++ and /dpt/ for the rest
Prepare OP pics
>>
>>59493576
>Rust
>OOP
>>
>>59493576
>Rust
>Relevant
>>
>>59493576
>Rust
>Good
>>
>>59493576
>Rust
>>
>>59493576
>Fe2O3
>>
>>59493626
>2x26+3x8
>>
File: meme_lang.jpg (40KB, 310x207px) Image search: [Google]
meme_lang.jpg
40KB, 310x207px
>>59493576
>>
So moved to vim, I'm finding it pretty good, but pressing esc to go to normal mode is annoying. What do you use?
>>
>>59493698
I still use it, but I hear mapping Caps Lock to Esc is common.
>>
>>59493698
You get used to it.
>>
>>59493698
You can always use Ctrl+[ , but I use J+K pressed simultaneously in my spacemacs.
>>
>>59490668
Whoa, you guessed your own post number by accident
>>
>>59491119
Who here collects their friends souls contractually for favours?
>>
>>59493576
>|°\|_|5-|-
>>
>>59493576
int main(int argc, char ** argv) {
printf(">Rust");
return 0;
}
>>
File: Milhouse_Van_Houten.jpg (20KB, 420x400px) Image search: [Google]
Milhouse_Van_Houten.jpg
20KB, 420x400px
Is >Rust a meme now?
>>
>>59493830
Rust was a meme since the very beginning
>>
Whats a fizzbuzz
>>
File: story1802_animgif.gif (168KB, 600x450px) Image search: [Google]
story1802_animgif.gif
168KB, 600x450px
>>59493143

Uh, yeah. I t-totally know what you mean, a-anon...
>>
rust is shit, it doesn't have a cleaner syntax than C++, it doesn't provide any compelling reason to use it over C++, and just look at that fucking code of conduct, why would you use a language by failed mozilla webdevs/browserfags
>>
>>59493911
I don't want to come off as defending Rust, but how the fuck can you defend C++'s garbage syntax?
Rust's syntax is shit too, but it's nowhere near C++ levels of retardation.
>>
What is a "clean syntax" anyway? Can anyone give me a non-ironical example of a PL with a clean syntax?
The only one I can think of is Haskell without extensions.
>>
>>59493908
He just rattled off a bunch of .NET tech that can apply to a bunch of different types of programs. You can google most of those and get a result back. EFCore is Entity Framework Core, I assume.
>>
>>59493985
lisp
>>
>>59493985
java
>>
>>59490750
Its decent, just saying.>>59491437
>>
>>59493902
This
#.(loop for i from 1 to 100 do
(format t "~:[~:[~a~;Buzz~]~;Fizz~:[~;Buzz~]~]~%~@*" (zerop (mod i 3)) (zerop (mod i 5)) i))

If you can't do this in 5 minutes without any help, you fail the interview.
>>
>>59492525
Rust
>>
>>59494024
Lisp has no syntax tho.
>>59494027
Well, yeah, in a sense. But this is a direct result of the language being a dumbed-down version of C++ - the more primitive the language is the cleaner the syntax it has.
>>
>>59493985
Syntax that makes it easy to quickly recognize what a particular piece of code is. Note that that's not the same thing as knowing what the code DOES. PL can have clean syntax, but it can still be hard to figure out what's going on. What is IMO way more important in a language, is the level of readability that you can achieve with it. For example Java has clean syntax, but there's often so much code, that it takes longer to figure out what's happening. If you work with pajeet code, you could also argue that it's more important that one can't accidentally write unreadable code. You don't want to maintain Indian perl scripts.
>>
>>59493985
>non-ironical example
what did he mean by this?
>>
>>59490616

int a = * (int *) &x;

>>
File: 4chan.jpg (53KB, 800x450px) Image search: [Google]
4chan.jpg
53KB, 800x450px
>>59493576
I say each of Java, C#, Rust and C++ deserve their own daily threads in a /prog/ or /cs/ subreddit, I mean chan.

Make it happen.
>>
>>59490663
wtf yo
>>
>>59494005
It was actually a somewhat coherent application design if you know what all of that is.
>>
>>59490616
I posted on /wdg/ but no one answered, maybe one of you knows.


I'm working on a website where I want to upload a big number of files at the same time via a form (sometimes ~200). The form is made and works in localhost, but in the server I'm limited to 20 files maximum by upload.
Sadly I can't access and modify the php.ini

Upload files by group of 20 is a bit annoying. Is there a way to remove this limit ? Via the .htaccess ? via ini_set ?
>>
>>59494635
Nope, you have to do it within php.ini.
>>
>>59494527
For me personally, it's one of those cases where I know all of the words but I only actually have hands-on knowledge/understanding of two.
>>
>>59494635
Accept zip files, unzip in the server.

Next!
>>
in database design, is many small tables with a single "responsibility" preferred over larger "polymorhic" tables?
even if it means a lot more boilerplate creation of said small table rows
>>
>>59494828
I got a code in php that works on the files, and send data to a database.
I'm fucked up.
I guess my solutions are to upload by 20 or find a better host
>>
Hello, /g/, sorry this is not my home board so apologies if wrong place.
I have a shell script, which I want to activate with touch of button(even if I am in GUI and don't have terminal open. How to make program(or any existing program) which does this?
Basically, if I press a special key on keyboard, it does "emulates the shortcut key to open terminal, it terminal types in predefined text to open script". I think in windows there is auto hot key or something, so how to make this in linux? Thankyou.
Also does everyone here use "gentoo" why here always everyone is asking to install "gentoo"?
>>
Are these recursive rules the same?
c -> a || a c

and
c -> a || c a
>>
>>59494881
Try >>59487792 or >>59492600 .
>>
>>59494864
So?
mime_content_type()
is your friend; if the file is an
"application/zip"
unzip it to a temp folder before proceeding. How much spoonfeeding do you need?
>>
>>59494864
>send data to a database
Waitaminute, you aren't saving the files as blobs inside the database; are you?
>>
File: useful.jpg (46KB, 502x370px) Image search: [Google]
useful.jpg
46KB, 502x370px
>>59494864
maybe a better language too?
>>
>>59494908
Thankyou
>>
>>59494881
xmodmap
>>
>>59494924
>Waitaminute, you aren't saving the files as blobs inside the database; are you?
nope.
>>
>>59494973
Good.

Did this >>59494910 work?
>>
>>59495004
>Did this >>59494910 work?
I'm not working on it right now so I can't tell, but it should work.
>>
OOP is a serious paradigm of programming which takes pretty huge part of /dpt/ messages.
I strongly believe, that discussions of advantages and disadvantages of OOP, as well as discussions of the languages that implement this paradigm (i.e. C#, C++, D, Java, Rust) deserve their own thread.
>>
>>59495110
it would result in shitposting general threads
>>
>>59495110
Nah.
>>
>>59495110
>OOP is a serious paradigm of programming
ΛΩΛ
>>
>>59490616
Got a class project, we're wrapping up usage of the stack in class and we're making a traditional stack-based calculator (take infix input, turn it into postfix, and solve the postfix). Implementing the stack has made the most sense for the project so far, but I'm stuck on the logic for picking apart the infix input and converting it: how do you test for operator precedence?
>>
>>59495110
Only if it's about CLOS.
>>
>>59495193
(slot-value me 'nigger)


>>59495180
https://en.wikipedia.org/wiki/Shunting-yard_algorithm
>>
>>59494864
If the problem is that it annoys the user, can't you just upload the forms with ajax?
>>
>>59490616
is this super strict java coding style really necessary?
>>
File: how2camelcase.png (6KB, 193x167px) Image search: [Google]
how2camelcase.png
6KB, 193x167px
>doing peer feedback for weekly JS exercise in uni course
>see this
>>
>>59495287
This picture gave me eye cancer
>>
>>59495287

10/10 programming
>>
>>59495214
Yeah I get the algorithm, how do you actually check for the operator precedence part? I've been looking online and there are examples of it but almost all of them skip over the operator precedence or call an unwritten
precedence()
method.
>>
Spaced repetition is the key to success. You do have an anki deck with data structures algos and their properties and application areas... right?
>>
>>59495418
>how do you actually check for the operator precedence part?
You implement
precedence()
to use a LUT
>>
>>59495287
>triAngles
>scatalan spotted
>>
Finally!
OOP realm, so the only relevant paradigm programmers could leave animu, C(ommunism) and Hasklel losers sink in their circlejerk!

>>59495452
>>
>>59495493
Enjoy your community of pajeets
>>
File: filter-g.png (2KB, 410x62px) Image search: [Google]
filter-g.png
2KB, 410x62px
You can't stop me
>>
sorry if offtopic
>Newb to git

How do you organize the versions of your programs?
Example
>BitcoinPriceChecker.git
>Master is written in bash
>Realize python will be more flexible for multiple json requests to server API
What do with my initial code?
Do I store it in a branch called Alpha?
Can I read anywhere how people manage their projects?
I feel like there has to be a better way.
>>
>>59495541
Try uth.
>>
>>59495541
jokes on you that filter probably uses regex
>>
>>59495542
goto >>/g/sqt ;

https://git-scm.com/docs/gittutorial
https://try.github.io/levels/1/challenges/1
https://www.atlassian.com/git/tutor
>>
>>59495418
Forget about shunting yard, it's pretty garbage.
A straight forward recursive precedence climbing parser is much easier to implement because you just do the obvious thing of exhaustively recurse down in parens, exponents, mul/div and finally add/sub - the order is your precdence.
>>
>>59495662
Or use /pol/'s method
https://en.wikipedia.org/wiki/Operator-precedence_parser#Alternative_methods

"a * b + c ^ d / e"
=>
"((((a))*((b)))+(((c)^(d))/((e))))"
>>
Do you listen to music while programming?
What do you listen to?
>>
>>59495811
Yes, mainly anime music.
>>
>>59495811
Mainly JSBach
>>
>>59495662
>recursive
At the rate we're going, we might not even get to recursion in this semester (we're supposed to by at least middle of next month), but that sorta makes sense just reading it.
>the /pol/ method
top wew
>>
File: dt170320.gif (117KB, 900x277px) Image search: [Google]
dt170320.gif
117KB, 900x277px
LOL
>>
>>59495856
>we might not even get to recursion in this semester
Are you too stupid to learn on your own?
>>
>>59495899
I work full time with night classes and actively looking for a new job, so it's not like I have the time of a NEET or undergrad right now to go further ahead. No problem when the semester is over and I have some time to spend after work.
>>
>>59495955
You can't learn programming
>>
>>59495899
Not him, but he may be expected to not use recursion. If you are asked to write a 100-word essay on trains, you won't get a better grade for writing an encyclopedia on airplanes.
>>
>>59495975
Its not like learning recursion takes more than 30 minutes. Most people already understand it. For example, how do you build a lego tower 300 blocks tall? You build a lego tower 299 blocks tall and add a single block.
>>
Hey /dpt/, I need your guidance on a particular problem I need to solve.

I have an OS X computer that is used to type Purchase Orders, the person who will be working on it needs a simple GUI to speed up the process, the output must be a DOC file with all the data and the layout of the company...PLUS there needs to be a simple CRUD for products and providers, how could I achieve this?

I've never programmed in OS X, I believe I could pull this off on my own if it was Windows.
>>
File: VQSucsH.png (228KB, 858x725px) Image search: [Google]
VQSucsH.png
228KB, 858x725px
>>59490616
I'M MAKING A G.A.M.E
>>
>>59496054
>Gay Anal Masturbation Entity
>>
File: 1489780369974.png (32KB, 1172x675px) Image search: [Google]
1489780369974.png
32KB, 1172x675px
>>59496069
exactly
>>
>>59496036
Install gentoo, then proceed as usual
>>
File: sel.jpg (167KB, 1010x768px) Image search: [Google]
sel.jpg
167KB, 1010x768px
>>59490616
I'm uploading my mind into the internet.
>>
File: halp.png (162KB, 1440x900px) Image search: [Google]
halp.png
162KB, 1440x900px
rate
>>
I have a rather time-consuming function in C that will always return the same result for the same input and is likely to be called for the same input many times during the course of a program - usually many times in a row.

Should I save the results in a manual "cache" or is there an automatic way to do it (or will the compiler take care of that with specific settings)?

(New to C)
>>
New thread:

>>59496107
>>59496107
>>59496107
>>
>>59492357
>void read(int &testCases, std::string *&lenOfStr, std::string *&inStr)

why not just pass std::string *lenOfStr?
You're just getting the address of the pointer, and dereferencing the address to get the pointer. Seems redundant
>>
>>59496113
>Should I save the results in a manual "cache" or is there an automatic way to do it (or will the compiler take care of that with specific settings)?
You have to manually cache it.
The easiest way to do it is to make a hash table that hashes the inputs and retrieves the cached output.
>>
>>59492357
>
std::string *&lenOfStr

This is a pointer to reference of string. Very pointless.
Your calling seems to imply you wanted
>
std::string *lenOfStr
>>
i'm trying to create a very simple chat client in c# for what would essentially be comparable to twitch chat, i'm able to connect and receive notification when messages come in and etc. etc.

but, i'm having a real hard time using the correct type of "control" to actually display the messages, i'm using WPF and it seems like every option I have available has some kind of stupid issue

originally i used a itemscontrol and passed in my own class as the item template and defined a data template, but: this uses a fuck ton of memory to the point of being kind of embarrassing and resizing the stupid ass window lags a LOT (due to not having 'virtualization'). I moved to a listbox + item template for virtualizing, but the window doesn't know how to define the new sizes (? dont know how say it, it wont snap to the bottom of the screen because of how it virtualizes old messages) when they come in so theres always some kind of ugly looking gap at the bottom of the screen and everywhere online says its unavoidable

last i used a richtextbox and set it to add new 'paragraph's which are the messages but again it has no virtualization and resizing looks fucking bad and lags

why is it so hard to emulate the experience of a browser with simple html? it seems like it would be easier to just set up a webview to some html+js implementation of the chat but that defeats most of the purpose of it being native
>>
File: 2017-03-20_174740_446862018.png (3KB, 933x154px) Image search: [Google]
2017-03-20_174740_446862018.png
3KB, 933x154px
I'm a bit out of my depth here but is there any obvious reason why the highlighted examples on the top are recognized when this executes but the example below in the else statement is ignored?
>>
File: 2017-03-20_175341_963887351.png (2KB, 366x176px) Image search: [Google]
2017-03-20_175341_963887351.png
2KB, 366x176px
>>59496887
related
>>
>>59490616
im new in programming, what the fuck is template? is this c#?
>>
>>59496938
C++
Thread posts: 322
Thread images: 40


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