[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: 317
Thread images: 44

File: 1464564856240.jpg (164KB, 960x960px) Image search: [Google]
1464564856240.jpg
164KB, 960x960px
Old thread: >>56220025

What are you working on, /g/?
>>
>>56225966
>>56225966
>>56225966
>>56225966
>>
OP is clearly not raising a false flag edition
>>
>>56226131
Lock it for the whole method, not just for mutation: what happens if another thread appends the resource to the list after you've concluded that it wasn't present but before you add it too?
>>
>>56226097
I'm convinced this is some assmad normie trying to give the mild trap posting a bad name.

Working on programmatically duplicating a database as temporal tables.
>>
File: 1440951724379.png (936KB, 759x1080px) Image search: [Google]
1440951724379.png
936KB, 759x1080px
Lisping around.
>>
>>56226210
What's a temporal table?
>>
>>56226131
>>56226197
Use one of the thread-safe collections that are built-in, you triple nigger.
>>
File: yay.jpg (8KB, 259x194px) Image search: [Google]
yay.jpg
8KB, 259x194px
>>56226216
Lisping with what exactly?
>>
(car l)
(first l)
(pop l)
(nth l 0)
(elt l 0)
(aref (make-array 1 :initial-contents l) 0)
(elt (make-array 1 :initial-contents l) 0)
(car (coerce (make-array 1 :initial-contents l) 'list))
(first (coerce (make-array 1 :initial-contents l) 'list))
;; ...


>this is how you access the first element of a list in lisp
>>
File: anal beads.png (104KB, 884x825px) Image search: [Google]
anal beads.png
104KB, 884x825px
>>56226210
>>56226219
https://msdn.microsoft.com/en-us/library/dn935015.aspx

New feature in SQL Server 2016 that gives you built-in data versioning.

The idea is that I can say "This was the state of your computers/whatever as of March earlier this year."

The OTLP systems don't have this functionality built-in, so I'll implement it in the data warehouse.
>>
File: 1460558930039.png (714KB, 1050x1050px) Image search: [Google]
1460558930039.png
714KB, 1050x1050px
>>56226247
My own lisp.
Working on adding support for environments right now.
>>
File: 1466398746960.png (129KB, 314x278px) Image search: [Google]
1466398746960.png
129KB, 314x278px
>>56226268
>decide to write your own language
>decide to write a lisp
>>
File: sugoi.jpg (8KB, 191x264px) Image search: [Google]
sugoi.jpg
8KB, 191x264px
>>56226268
Awesome!
Do you have any tutorials on how to implement your own lisp?
>>
>>56226268
make sure you don't windows environment

communism telemetry I bet feeds pigs

no justice for the wicked, GNU
>>
File: woot.png (304KB, 722x768px) Image search: [Google]
woot.png
304KB, 722x768px
>>56226302
huh?
>>
File: 1458674350880.jpg (112KB, 960x720px) Image search: [Google]
1458674350880.jpg
112KB, 960x720px
>>56226280
Yes, why not?

>>56226295
Only http://www.buildyourownlisp.com/ but I haven't read it. Do you want to make your own? It's very fun :3

>>56226302
???
>>
>>56226280
Nothing wrong with that, anon.

>>56226295
You might want to look at Lisp In Small Pieces.
>>
Still working on my simple comment board.
I imposed a 250 character limit, but all special characters get turned from into garbage like %3C%14 when they get received through POST.
I figured out how to convert them back to UTF-8, but they still take up 3 characters instead of one.

How do I stop this shit?
I'm using lighttpd if it helps.
>>
>>56226323
>that unix time fuckup

How did you even manage to fuck that up?
>>
File: ham.gif (40KB, 405x200px) Image search: [Google]
ham.gif
40KB, 405x200px
>>56226313
Yes i do!
Actually biggest issue is tokenizer/parser rest should be fun figuring on my own.
>>
>>56226323
>take up 3 bytes
Ftfy
You are confusing bytes with characters. Look for unicode/utf8-aware function in whatever memelang you are working.
>>
File: 1447938637543.jpg (70KB, 640x480px) Image search: [Google]
1447938637543.jpg
70KB, 640x480px
>>56226323
Like this? http://mebious.co.uk/
>>
>>56226097
Where do I store username/password for a server's service account when I need to access those values within my code?
>>
>>56226342
You should be able to do it by having a while loop and a switch statement in it. When you see a '(' you do something like
node->inside = new_node (); self (node->inside);
. When you see a space you just create and move to the next node while when you see a valid character you add it to the current node.
The node structure would be like
struct node
{
bool issym;
union {
struct node *inside;
char *symbol;
}
struct node *next;
}
>>
>>56226436
In your code. But it's not secure and your post shows that you don't even grasp the first bit of doing it securely. Educate yourself about hashing and don't come back.
>>
Does someone here understand javascript replace?
I have found the segment I want to manipulate with match, but when I take the result to use as my replace parameter, nothing is found.

The string contains chars such as quotes and newlines, but I doubt this is why.
Is there anywhere they have documented this or am I supposed to keep guessing until it works?
>>
File: thanks.jpg (78KB, 1280x720px) Image search: [Google]
thanks.jpg
78KB, 1280x720px
>>56226437
Thanks, i guess its best to start and figure it out as i go.
>>
>>56226474
You sound really smart, anon.

If my code has the capability of decrypting the values, wouldn't that be just as insecure as storing the values within the code as plaintext?

I mean, if they can determine a string's contents, surely they can determine my hashing algorithm.
>>
>>56226258
>lol, this language allows you to do things in many different ways
Go play with your toys, skiddie.
>>
>>56226500
>Is there anywhere they have documented this
No. No one has documented Javascript's replace function. It was determined to be entirely to esoteric for your average developer to use properly.

It's a wonder that the ability to replace elements even still exists in the language.
>>
File: moot.jpg (85KB, 1024x512px) Image search: [Google]
moot.jpg
85KB, 1024x512px
>>56226527
Who are you quoting?
>>
>>56226553
(You)
>>
>>56226500
I might as well append my minimal working example...

>>56226537
I really can't tell if you are joking or not..
>>
>>56226514
>If my code has the capability of decrypting
It shouldn't. If you can reverse a hashing algorithm, then it's a bad hashing algorithm.
>>
>>56226573
>>lol, this language allows you to do things in many different ways
I never said this
>>
>>56226579
Then how do I pass that to a pre-existing application expecting credentials?
>>
>>56226591
Greentexting is not only for direct quotes, newfriend.
>>
File: anal beads.png (7KB, 203x196px) Image search: [Google]
anal beads.png
7KB, 203x196px
>Haskell
>>
>>56226615
are we 46 developers now?
Neat
>>
>>56226615
>it's the second result
Other languages btfo
>>
>>56226336
i inserted those manually

>>56226360
No, i'm pretty sure a character like %21 is only supposed to take up one character because it represents '!'.

Also, for that matter, how are characters counted when working with multi-byte UTF-8?
If a kanji is 3 bytes, does it still count as a single character?
>>
>>56226553
*whom
>>
>>56226633
That's just the order I searched them, from bottom to top.
>>
>>56226258
>self-documenting code
>>
>>56226575
I am an idiot...
if( str.indexOf("<seq") >= 0 ) { //if the code contains seq declaration
var res = str.match(/<seq[\s\S]*?<\/seq>\n/g); //find them
for( var i = 0; i < res.length; i++){
new_place += res[i]; //append them somewhere else
str.replace(res[i], ''); //remove them
}
}
>>
File: hipster fedora.jpg (18KB, 236x354px) Image search: [Google]
hipster fedora.jpg
18KB, 236x354px
>>56226615
i wonder if these fucking stupid faggot tards will move on to another shitty meme lang IF haskell becomes slightly popular
>>
>>56226663
>being this mad that someone enjoys their language
you didn't need to post a selfie too
>>
File: disgusted mickey.jpg (20KB, 255x220px) Image search: [Google]
disgusted mickey.jpg
20KB, 255x220px
>>56226661
>if(
>for(
>>
>>56226685
I see your point...
>>
>>56226638
>No, i'm pretty sure a character like %21 is only supposed to take up one character because it represents '!'.
Uh?
>Also, for that matter, how are characters counted when working with multi-byte UTF-8?
The function runs through the string and decodes it just enough to know.
>If a kanji is 3 bytes, does it still count as a single character?
Obviously yes. Except if you mean something related to chinkoglyphs rather than utf-8 with 'three bytes'?
>>
>>56226661
Wow.
>>
>>56226575
>>56226661
>>56226705
try s/\.\.\./\./
>>
>>56226661
>In slow language uses even slower regexp
you should be using indexOf instead
>>
if you program in C and you call malloc more than a few times every 10kLOC you are a pathetic joke of a programmer
>>
File: MM8117_140710_36969.jpg (342KB, 1620x1080px) Image search: [Google]
MM8117_140710_36969.jpg
342KB, 1620x1080px
i am snek

what lang should i use
>>
>>56226757
>if you program in C...you are a pathetic joke of a programmer

Rude.
>>
>>56226592
Wait you're in a client application? If this is a human user's password ask for it everytime (or ask for something to decrypt it but that's silly (not if the password isn't human friendly but then use a password manager manually)), if this is a bot use a config file and a randomly generated password.
>>
File: python cs grad.jpg (45KB, 695x431px) Image search: [Google]
python cs grad.jpg
45KB, 695x431px
>>56226766
le meme snek
>>
File: retard.gif (54KB, 625x626px) Image search: [Google]
retard.gif
54KB, 625x626px
>>56226757
>look mum I'm so smart!
>>
>>56226789
Who are you quoting?
>>
>>56226783
It's an automated application that does some CRUD work every night on databases.

Needs to access a few databases with various credentials.

I'm assuming that since the application is internal-only, I could just ship it with a config file with the credentials.

I mean, if someone has access to the actual server, it's already compromised, right?
>>
>>56226789
just because you program in C doesn't mean your program is efficient by default
>>
>>56226097
>>56221230
>but i think it's a waste to learn it as your first language, you can pick up java in literally a week, with C there is so much C-specific bullshit and gotchas surrounding it that aren't fundamental to learning programming

#include<stdio.h>

int main(void)
{
char letters[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i,k;

for(i=0;i<6;i++)
{
for(k=0;k<=i;k++)
{
printf("%c",letters[0+k]);
}
printf("\n");
}



and this should be the result
A
BC
DEF
GHIJ
KLMNO
PQRSTU


certain eastern-european site where everyone brags about earning $60k/yr as a programmer
>>
File: not an argument cool edition.jpg (39KB, 468x553px) Image search: [Google]
not an argument cool edition.jpg
39KB, 468x553px
>>56226832
>sentence with no subject
>>
>Template metaprogramming allows the programmer to focus on architecture and delegate to the compiler the generation of any implementation required by client code. Thus, template metaprogramming can accomplish truly generic code, facilitating code minimization and better maintainability (C++ templates)

Is this actually possible? Has anybody accomplished writing a non-trivial, completely generic program?
>>
>>56226757
>10kLOC

wat is dat?
>>
>>56226885
Its possible, C++ templates are turing complete. I wouldnt do it.
>>
File: why so disgust.jpg (60KB, 550x456px) Image search: [Google]
why so disgust.jpg
60KB, 550x456px
>>56226859
>letters[0+k]
>not 'A' + k
>no indentation
>mismatched braces
>using printf for a single char
>postfix increment in a for loop
>k<=i;
>>
>>56226891
ten thousand lines of code
>>
Got bored, spent an hour and a half building a little RPN calculator. It has built-in functions (trigonometric functions, square root, power, etc.), built-in variables and temporary variables.

I can feed it horrors like

4 3 + x:= ; 5 3 * y:= ; x y + z:= ; z


and it prints 22. "varname:=" creates a new temporary variable, while "varname=" assigns a new value to an existing temp variable. When creating/changing a variable, the topmost value in the stack is used as its value. Semicolons separate statements.

More examples:

2 sqrt          # returns 1.41214
2 10 pow # returns 1024
45 sin 16 * # returns 11.453433
10 5 > # returns 1, because 10>5
pi 2 / # returns 1.570795


I guess it could be used as a *very* minimalistic scripting language somewhere. Obviously I need to turn it into a function that takes a string and a list of variables and it returns the value instead of printing it. And its error handling is in dire need of a complete overhaul.

I also thought about compilation, ie. turning the input into a set of opcodes that a small VM runs. But that's for another day.
>>
>>56226820
>I mean, if someone has access to the actual server, it's already compromised, right?
Yah kind of. Even if it's a cryptic form of credential, it's still a valid credential. Just double triple check it's not in for any kind of escalation and that it's not a literal password you also type manually. (bet that you reuse even if you're not aware of it) And config files aren't necessarily part of software packages, quite the opposite, so you could still distribute it without the internal-use config file.
>>
>>56226885
Yes, through FP autism.
http://pastebin.com/2uH3GZDN
>>
>>56226885
What do you mean by generic program?
There is plenty of libraries (eg. as part of standard ones) that provide only generic containers or other structures.
>>
>>56226907
>I also thought about compilation, ie. turning the input into a set of opcodes that a small VM runs. But that's for another day.
Sounds like a neat exercise.
>>
>>56226933
*sounds like a NEET exercise
>>
>>56226724
I am not sure what you mean...
>>
>>56226942
Ditch the ellipses.
>>
>>56226757
How could I make a binary tree otherwise?
>>
>>56226859
k=0 is executed at each turn of the i loop.

Also why 27 chars when there are 26 letters? Or am I being really dumb?
>>
Can i do this?
char *convert_str(...) {
static char[30] a;
/* ... */
return a;
}


It's a short string that I don't want to malloc memory for, I'm only going to use it once per call and if I want to save the string returned I can just strcpy it.
>>
>>56226899
>not 'A' + k
Wrong
>>
>>56226363
what's that
>>
>>56226896
>>56226917
That seems pretty amazing
If it's really as viable/advantageous as that article implies, I woudn't mind trying it
>>
>>56226899
>>postfix increment in a for loop
And this is fine.

>>56226959
'\0'
He should have used []
>>
>>56226968
No, you can't.
>>
>>56226983
Yeah, just look at all the people doing things like this every day to be productive.

Lots of people use this sort of design in production systems!
>>
>>56227024
>wahhh don't you dare do it, because no one else does it
kill yourself as soon as possible
>>
Hey lads I'm a massive fucking noob retard skript kiddie at best when it comes to programming stuff (i.e changing BF2's single player to spawn 64 bots instead of 16)

I used python 3 and visual studio code to n00b out and do the 'Hello world' exercise so wtf do I do from there? Also any good links or references to texts for complete idiots would be great.
>>
>>56227061
What are you sperging about?

Lots of people use it, because it's extremely useful and isn't difficult to conceptualize at all!
>>
File: img1458.gif (4KB, 575x201px) Image search: [Google]
img1458.gif
4KB, 575x201px
>>56226953
>>
>>56227093
yeah let's instead dumb everything down so that 70 IQ pajeets can also do it

don't blame me when your boss asks you to train your shit-smelling replacement
>>
File: challenges_v4.png (2MB, 3840x2160px) Image search: [Google]
challenges_v4.png
2MB, 3840x2160px
>>56227080

L U R K M O R E
U
R
K

M
O
R
E
>>
>>56226661
fuck me...
I have been writing writing c++ for too long...
The replace function RETURNS the string, it doesn't modify the string.

Thanks for the help anyway guys...
>>
>>56227109
I will actually need to modify it, adding and removing nodes in the runtime. Also the number of elements in it will be unknown.
>>
>>56227024
Or you could just use lisp and let someone else make the compiler better

SBCL already produces okay binaries
>>
>>56227120
I don't understand what you're talking about.

Functional programming languages are really useful for collaborating on massive code-bases with hundreds of other people!

The syntax is very intuitive, and there's a massive workforce that knows a wide variety of functional languages!
>>
>>56227127
Why lurk when there's always a spoonfeeding faggot?
>>
I love C i always discover something new and neat. Even though language is simple it has shit ton of functions
 strcspn(const char *s, const char *charset);

returns complement of charset
>>
>>56227169
what does this do?
>>
>>56227150
That's why you resize using the next smallest prime number.
>>
>>56227163
???

we were talking about C++ templates, sarcastic sperglord

C++ is multi-paradigm and has a large amount of specialists and support
>>
>>56227080
Learn a real language instead of a script language if you dont want to be a script kiddie.
>>
Damn, hotpockets are fast today.
>>
>>56227196
Except that with your model it won't work.
>>
Writing an interpreter for a lambda calculus. I'm still deciding between intensional and observational equality. I might even go for something like homotopy in the end.
>>
>>56227165

Anon said that he is a "massive fucking noob retard skript kiddie at best", that was somehow touching, that's why.
>>
File: feet.webm (3MB, 800x450px) Image search: [Google]
feet.webm
3MB, 800x450px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA).

>>56227206
define script language.

>>56226891
>wat is dat?
https://www.youtube.com/watch?v=GqFYsvxHZOs&feature=youtu.be&t=20m5s
>>
I-Is there something like Project Euler but more general purpose instead of math-oriented?

The pro/g/gramming challenge set is nice, but I'm looking for smaller projects. Much like those you'd find at the end of programming chapter books.
>>
>>56227232
kys
>>
>>56227241
Codeval?
>>
>>56227229
THAT'S HOW THEY GETCHA
>>
>>56227232
Go away
>>
>>56227195
R T F M
T F
F T
M F T R
>>
>>56227241
Try hackerrank.
>>
>>56227241
CodeEval, HackerRank, CodeWars
>>
>>56227241
SPOJ
>>
>>56227200
I think he's whining about half-trained code monkies making up the majority of his coworkers

>>56227206
>2016
>people still say "script kiddie" when someone uses anything interpreted

Culture swung back around to the "perl wizard" paradigm when python started being used for NN and deep learning demos

now the only script kiddies are linux newbies who think bash is the shit, know nothing but it, and praise the unix way
>>
>>56227249
>>56227260
>>56227262
>>56227263
thanks m8s
>>
>>56227246
>puts on index on char*
U wot m8???
>>
>>56227232
A language that is mostly used to make quick throwaway programms, e.g. pythin
>>
>>56226280
Lisps are easy to parse and fun to make.
>>
>>56227288
>A language that is mostly used to make quick throwaway programms
From all the definitions /dpt/ gave, this one is probably the most retarded one.
>>
>>56227288
>pythin
so, a worm?
>>
File: argument circle.png (273KB, 558x520px) Image search: [Google]
argument circle.png
273KB, 558x520px
>>56227330
>>
>>56227365
he wasn't alone
>>
>>56227232
nice lens flare fgt
>>
>all these shitty limiting languages
Why are there so many shit-tier languages?
>>
File: maine cia.jpg (25KB, 418x328px) Image search: [Google]
maine cia.jpg
25KB, 418x328px
>>56227399
>>
>>56227241
You could always make up your own assignments.

Like image processing.
The math is not that complicated and you can see if you are doing the right things.
It also makes it very grounded as you know how the result is supposed to look like.

And you can do a lot of the same things.
Eg.
Write a sorting algorithm and apply it to your median filter.
Make a wavefront algorithm to solve a maze.
You could also implement your own image loader so you can learn more about how to deal with data.
>>
>>56227331
Typo. But you should know that i mean python
>>
About to start working on a new REST api. Currently all my other apis were build using nodejs but thinking about something else this time.

Anybody here already built an api with go? How does it compare to building one in node and what are the benefits/drawbacks?
>>
>>56227408
>hey you know that one thing we couldn't grasp about c++
>let's make a language directly around not having to do that
>>
>>56227442
use Spring Boot
>>
>>56227452
While I agree with that, I would actually include C++ as well on the list of these languages.
>>
Question to the Rust crab-people:

There's the old quote by Stroustrup that "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."

since while C++ has safeguards, circumventing them to do manual stuff takes you into undefined territory land and can make stuff fail in a spectacular manner and often in a completely different location from the faulty code.

Is Rust as bad outside of the safe spaces?
>>
>>56227472
Only because of C support.
>>
>>56227442
what are you even building a REST API for?
>>
>>56227495
>implying c features like macros aren't what makes c++ tolerable
>>
>>56227480
>Is Rust as bad outside of the safe spaces?
Rust's whole gimmick is that there isn't any outside in the first place. You always have your hand-held.
>>
>>56227498
because i wanna rest a little bit
>>
>>56227512
>ah yes C with classes, this is truly the pinnacle of programming
>>
>>56226859
#include<stdio.h>

int main(void)
{

for(int i = 0, j = 'A'; i<6; j += ++i)
{
for(int k = 0; k <= i; k++)
{
putchar(j + k);
}
putchar('\n');
}
return 0;
}
>>
>>56227495
?
>>
>>56227522
right

seriously though, are you trying to make some work/real world related API or just a hobby thing?
>>
>>56227533
Wrong
>>
>>56227533
#include <stdio.h>

int main()
{
for (int i = 0, j = 'A'; i < 6; j += ++i) {
for (int k = 0; k <= i; k++) {
putchar(j + k);
}
puts("");
}
return 0;
}
>>
>>56227562
How?
>>
>>56227520
I was thinking about unsafe{} code. What's the worst thing that can happen if you use it?
>>
>>56227575
Wrong as well.

>>56227589
You make assumptions on the encoding used.
>>
>>56227606
Excuse me?
>>
>>56227601
An immense feeling of suicidal dread for using a paradoxical language.

Just use C/++.
Rust is shit.
>>
>>56227464
Don't know any Java.

>>56227498
Previous reply wasn't me.

Have to build something for work and they let me choose the language it will be build in. Previous work was done in NodeJS but this time they expect more traffic and are open to new things.
>>
>>56227621
You make assumptions on the encoding used. What don't you understand?
There is nothing to guarantee to you that 'A' + something will be a letter.
>>
>>56227638
I beg your pardon?
>>
>>56227399
uhh you don't get to bring shitposters
>>
>>56227637
>they expect more traffic and are open to new things
your choices are pretty much C# and Java here

Python and traffic don't go together very well
>>
>>56227606
>>56227638
the assumptions are reasonable. it will work in practice.
>>
>>56227658
Don't know any C# or Java. That's why I was hoping on a comparison between NodeJS and Go.

I know a tiny bit of Go and could learn the rest if it's a viable option for an api.
>>
>>56227652
Are you shitposting or are you a legit retard?

>>56227660
Not guaranteed by the standard so no.
>>
>>56227686
>Not guaranteed by the standard so no.
kill yourself
>>
File: 2.jpg (3KB, 125x119px) Image search: [Google]
2.jpg
3KB, 125x119px
>Explain the difference between a imperative programming language and a functional programming language
>>
>>56227695
I stand by what I said.
>>
File: traumatic autiste.jpg (99KB, 703x516px) Image search: [Google]
traumatic autiste.jpg
99KB, 703x516px
>>56227706
So noble of you.
>>
>>56227697
Dynamic language: variables can change values and types
Static languages/imperative languages: Variables can change values but not types
Functional languages: Variables can't change at all.
>>
>>56227680
Do what you want, but you literally only have to create an API project and type 5 lines for a working RESTful API in C#.

It's piss-easy.
>>
File: questionOnPythonGUI.png (25KB, 1366x768px) Image search: [Google]
questionOnPythonGUI.png
25KB, 1366x768px
/g/ help
I don't understand this function in this python library.
Basically I'm trying to learn how to make GUI's in python, and I'm stuck here.
If anyone could just point me to what to read, that would also be helpful.
Question is in the screenshot.
>>
>>56227723
In dynamic languages, variables don't have types, values do (except for typeless/duck typed dogshit).
>>
>>56227777
Nice quads
>>
>>56227777
Holy fuck my eyes

Use a goddamn IDE
>>
>>56227794
>duck typed dogshit
Mind your words asshole. Duck typing is the best.
>>
>>56227697
Imperative programming languages are imperial and functional programming languages are actually functional
>>
>>56227531
It entirely depends on what kind of application you are making.
C is good if you need to control how the computer behaves, C++ is better if you are okay with some abstraction so you can solve more general problems.
This makes C++ better for desktop applications and C better for schedulers.
You can use C for desktop applications and C++ for operating systems, but this is not how they excel.

Take someone like Linus Thorvalds.
He is a C developer, and have good reasons to use that.

But when so many strangers contribute code to your project, mistakes are made and he makes a new rant about how idiotic the programmers are.
With C++, he would make rants about how the compiler programmers fucked up and simply deny people access who doesn't follow the coding standard.
>>
>>56227777
Well, you gotta __init__ the thirdNumber, innit?
>>
File: le weakly typed lang.png (36KB, 473x328px) Image search: [Google]
le weakly typed lang.png
36KB, 473x328px
>>56227814
>>
>>56227777
>python gui
>just point me to what to read

https://pypi.python.org/pypi/PyQt5
>>
>>56227697
>imperative programming language
sensible
>functional programming language
autistic (in a bad way)
>>
>>56227697
When comparing with 'imperative' it would be declarative, not functional; semantics is all, functional is just a subset of declarative.

anyways
imperative - programmer explains to the compiler/interpreter how to perform a procedure
declarative - programmer explains the class of output he wants and the computer handles the rest.
functional - no variables, only functions. You function functions together and you get more functions. There is no mutable state, and in principle there's no side effects but if it doesn't have I/O it's kind of pointless so that's allowed.
>>
>>56227837
This makes me giggle every time, but I know that shitty things like this could be found in nearly any language.
>>
>>56227686
>not guaranteed by the standard so no.

You do that, meanwhile the rest of the world will not be fucking autistic.
>>
>>56227822
>muh abstraction
>>
>>56227697

Imperative: HOW is something done (procedural).
Functional: WHAT has to be done (declarative).

For example:
>for (i=0; i<k; i++)
>foreach(e in elements)

Also often functional langauges has immutable values, can pass functions as first class objects (like variables), but not always.
>>
is there any use in getting an SSD if you just have your web browser and IDE open all day anyway, it's mostly just the loading times that are affected isn't it
>>
File: pence shig.jpg (65KB, 600x450px) Image search: [Google]
pence shig.jpg
65KB, 600x450px
>>56227947
>IDE
>>
>>56227940
you're fucking retarded please die in fire
>>
>>56227940
more like
>map/fold/etc
>>
>>56227940
Foreach is just this internally, probably not the best example.
for (i = 0; i < list.Count; i++)
>>
>>56227940
>can pass functions as first class objects (like variables), but not always
Even C has that.
If you do not have first class functions then you are not a functional language by any means.
>>
>>56227849
>https://pypi.python.org/pypi/PyQt5

I meant about tkinter and the __init__, isn't using this easier than PyQt5? Tkinter is already a library with many functions and I feel can easily make a useful program for myself in less than 500 lines of code. Like for ex. an invoice program for my dads auto body shop.
>>
>>56227977
It doesn't matter what it is internally
>>
File: ass.png (12KB, 791x231px) Image search: [Google]
ass.png
12KB, 791x231px
>>56227837
Can't really duplicate this because you can't real do math on strings like that, so I used chars and it was all just character code math at that point.

>tfw your language holds your hand
At least someone will...
>>
>>56227994
the how/what distinction is ridiculous and most imperative languages have foreach anyway, it's not a "functional" feature
>>
>>56227832
Why though, what is so significant about __init__ that i have to __init__ every single number variable.
Why can't I just make the object check with a third number variable that gets passed on to the checkFunction in the class SeaOfBTCapp??
>>
>>56227947
Faster compile times, much better general computer usage.

It's easily the most noticeable improvement you can buy for your machine.
>>
>>56227994
My point exactly.
>>
>>56227957
>Tfw want to use VIM but can't be fucked wasting days tinkering it to preference
>>
>>56228030
ok cool i think i'll get one for my next computer i'm definitely upgrading within a year from now
>>
>>56228030
>It's easily the most noticeable improvement you can buy for your machine.

Unlikely the case when you're programming, depending on what exactly you're doing you could benefit far more from a CPU/GPU upgrade.
>>
>>56228055
i'm gonna make a game so it might help with loading textures etc frequently? but it'll still be a really lightweight mobile game that should be no problem for a desktop
>>
>>56228082 (Me)
or maybe i can use a RAM disk or something instead of an SSD to make it even faster?
>>
>>56228030
>>56228055
I meant to say most noticeable bang-for-buck improvement.

Obviously, you get greater rewards from your lesser components if they aren't up-to-par (e.g. Upgrading from no graphics card to a discrete one).

>>56228082
Depending on your debugging emulator, you might consider getting a beefier CPU, but that's $300+ vs $80 on an SSD for different areas of improvement.

Consider deploying and debugging on an actual phone for basic testing. When I do Xamarin dev, I test on a physical S4 and chink tablet that I connect via USB, works with breakpoints and everything.
>>
>>56228098
>testing mobile shit outside of mobile shit systems
>>
Hey /dpt/, I am working on a quick implementation of CPUID on Linux (and I guess any compatables as well)
and while I was deriving the CPU model field the AMD manual specifies a different method then the Intel manual does.
Is this a legit difference that needs to be handled for AMD vs Intel or is the AMD manual fucked up?

I ask because I have a i5-2540m and doing a quick cat of /proc/cpuinfo shows that the model is 42 (0x2A)
but using the method outlined by AMD for determining the model gives me the wrong result. After changing it
to the Intel method I am able to get the correct Model from CPUID.

I can post code if needed.

tl;dr does the AMD use the Intel model versioning and the book is fucked or are they different.
>>
>>56228109
>>56228110
i plan on mainly developing on desktop to speed up the development process (it takes some seconds to load it on to a physical device), not in an emulator just actually running the game in opengl (maybe vulkan but most likely opengl) on desktop
>>
>>56228098 (You)

I doubt it's doing to make a significant enough difference to justify the cost. CPU/GPU generally helps with game dev depending on the engine.
>>
>>56228120
I mostly ask because I don't have a AMD processor to test this on else I would just try it there.
>>
>>56228143
if i use a RAM disk there is no extra cost since it uses the existing RAM and it might actually be faster than using an SSD?
>>
>>56228142
>it takes some seconds to load it on to a physical device
Just auto-deploy.

As soon as you start debugging, the app compiles and starts up on your device with debugging support.

Android emulators that have debugging capabilities are going to nuke your machine if it isn't pretty solid.
>>
>>56228109
On the Xamarin dev thing, how do you hook a connected phone up?

I just picked up Xamarin today and had a little tinker with it but I started to get irritated by the emulator within 20 minutes.
>>
>>56228165
it's an opengl (es) game, i don't need to emulate android for the core gameplay
>>
>>56228055
I've seen compilation times drop to 10% just with a simple spinning platter to SSD switch and generally an all around smoother experience.
>>
>>56228015
>most imperative languages have foreach anyway, it's not a "functional" feature
Where do you think they got the idea from?
>>
how bad idea is to write C macros for shortening stupid stuff like

#define NEW(x) (struct x*)malloc(sizeof(x))
>>
>>56227837
> [1,2,10].sort()
[ 1, 10, 2 ]
>>
>>56228231
There is no functional language with a foreach feature.
>>
>>56228239
Cancerous, don't do it.
Instead use this:
int *a = malloc (sizeof *a);
>>
>>56228268
but you should cast result of malloc...
>>
File: anal beads.png (12KB, 753x126px) Image search: [Google]
anal beads.png
12KB, 753x126px
>>56228173
Enable Developer's Options on your device. (Settings -> More -> About Device -> Tap Builder number repeatadly until Developer Options is enabled

Go into Developer Options and select USB Debugging

Open VS and you should see it in the debug drop-down
>>
>>56228252
traverse_ print [1,2,3]
>>
File: 1444146154791.png (1MB, 1280x720px) Image search: [Google]
1444146154791.png
1MB, 1280x720px
>>56228275
This is not true.
>>
>>56228286
that's no foreach, that's a map.
>>
Best resources for a complete beginner to programming/coding?
>>
>>56228293
but senpai, malloc returns void* ! Yes it compiles without but compiler complains
>>
>>56228316
Learn C or Assembly to get TRUE MEANING OF DEVELOPERMENT

Just don't learn Java or C#! They are communism!
>>
>>56228310
... No it isn't.
>>
>>56228316
Programming from the Ground Up, Jonathan Bartlett
>>
>>56228325
Assblasted Javafag detected
>>
>>56228283
not the same anon, but is that windows 10?

do you use visual studio to develop android apps?

shouldn't you use Android Studio ?

sorry i'm new to this thing
>>
>>56228321
Exactly, because it returns void * you do not need to cast anything. Values from and to void * need no casting.
No C compiler will complain about that, what compiler are you using?
>>
>>56228348
No no, I said DON'T learn Java!
>>
File: xm9Pxmr.png (4KB, 422x81px) Image search: [Google]
xm9Pxmr.png
4KB, 422x81px
>>56228283
Did all that but had no luck unfortunatel, I can see the phone in the Device Monitor as well, but for some reason VS is not interested.
>>
>>56228316
K&R
Become a god.
>>
>>56226615
>sql ''''''''''''developer'''''''''''''
>javascript ''''''''''developer'''''''''''''
lol
>>
>>56228349
>not the same anon, but is that windows 10?
Yes
>do you use visual studio to develop android apps?
Yes
>shouldn't you use Android Studio ?
No, I'm using Xamarin. I prefer C#:
https://www.xamarin.com/
>>
File: nope.png (59KB, 1366x768px) Image search: [Google]
nope.png
59KB, 1366x768px
>>56228321
nope
>>
>>56228379
you use the free edition?
>>
>>56228231
so if imperative languages are functional too then there's no reason to use a purely functional language, you can just use an imperative/multi-paradigm language like C++ and get the best of both worlds
>>
>>56228293
>>56228351
to maintain compatibility with C++ but I think
Extern "C" {
deals with that anyway
>>
Is there a good summary somewhere of the differences between modern C and the C-like C++ subset?
>>
>>56228327
>I know nothing
>>
File: Korosensei_Anime.jpg (115KB, 1280x720px) Image search: [Google]
Korosensei_Anime.jpg
115KB, 1280x720px
>>56226097
Koro sensei would like to have a word with you.
>>
>>56228401
No, you idiot.
If you actually tried a functional language you'd realise.

"Multi-paradigm" languages are all procedural shitfests. They haven't been thought through at all. You can't work with functions nearly as easily in imperative languages, so there's less of a point to using higher order functions.

I could just as easily say "Haskell has procedures (imperative functions) via IO & do blocks so why don't you choose the best of both worlds"
>>
>>56228391
>>56228351

oh, my makefile was set to c++14 and clang haha
>>
>>56228400
Xamarin is free.

It's open source, too.

They make money on mobile device farms for enterprise app testing.

If you meant Visual Studio, yes that's free, too. VS Community isn't missing any features you'd need for indie dev.
>>
>>56228428
C++ has function pointers and lambdas what else could you possibly need
>>
>>56228438
>Arguing with functional autists
>>
>>56228422
Then maybe you shouldn't be talking about it.

traverse_ :: (a -> f b) -> t a -> f ()

Notice the f ()? Not only do you get back a unit value, but you don't even keep the container

>>56228438
Actually try a real functional language for once
"Function pointers and lambdas" are nowhere near enough

FP: (+5)
C++: [](auto a){ return a + 5; }
>>
>>56228450
>haskell
Meme language, fuck off.
>>
>>56228465
Elaborate
>>
>>56228434
>Xamarin is free.
>It's open source, too.
lol cuck it's not free at all they could shut it down or change the license and charge money at any time

https://robovm.com/robovm-winding-down/
>>
>>56228465
Nice response you fucking idiot

You managed to get me to reply, so clearly you achieved your fucking aim

The funny thing is I might even know C++ better than you do
>>
File: Screenshot - 230816 - 18:42:07.png (69KB, 1315x514px) Image search: [Google]
Screenshot - 230816 - 18:42:07.png
69KB, 1315x514px
>>56228434
i was talking about Xamarin.

Also , another question, if you don't mind:

why don't you choose to program for android with Java?

Could you recommend resources to learn app developement?
>>
>>56228401
>>56228428
Right, the vast majority of languages sold as "multi-paradigm" are still heavily procedural. Common lisp is arguably the only truly unopinionated multi-paradigm language that I can think of. Others are effectively imperative languages with some functional features.

Imho, one of the best things you can do if used to procedural languages is not to pick a multi-paradigm language, but to learn a fully functional language that will force you to code in the functional style for a while, so you don't fall back into the imperative trap. This will give you much better habits for when you do return to other languages.
>>
>>56228477
just use java for fuck's sake, xamarin is the same as the java android api anyway jeez
>>
>>56228473
>lol cuck it's not free at all they could shut it down or change the license and charge money at any time
Any project can do this. It wouldn't invalidate the previously distributed licenses on older versions. You should learn how licenses work.
>>
Just implemented delimited continuations for my own little language (basically untyped lambda calculus) in C. In the end the implementation isn't so complicated as I thought, but I really had to think on how to do it (my interpreter isn't in CPS so it wasn't that trivial.)
>>
File: 1468629950028.jpg (472KB, 1000x625px) Image search: [Google]
1468629950028.jpg
472KB, 1000x625px
>>56228424
"W-we were just playing sensei"
>>
>>56228495
kill yourself you insufferable fedora-tipping neckbeard
>>
>>56228495
The funny thing is imperative programming is easy in Haskell

>>56228514
Calm down you fucking 12 year old
>>
Do you people post on /dpt/while you're at work?
>>
>>56228475
>The funny thing is I might even know C++ better than you do
Probably but this is unrelated to the topic, I did not even mention C++ in my post. Are you a schizo?
>>
>>56228473
The current project is released under MIT.

Do you know how licensing works? Literally any open-source organization could do this.
>>
>>56228498
have fun maintaining a deprecated version by yourself IDIOT. android is always changing you IDIOT. xamarin is an unnecessary potential point of failure. you can reasonably expect that google won't shut down its android support any time soon, but you can't with xamarin.
>>
>>56228495
>Common lisp is arguably the only truly unopinionated multi-paradigm language that I can think of. Others are effectively imperative languages with some functional features.
Nothing about Scheme?
>>
>>56228530
So you're saying you're neither of the people I replied to?
Yet you somehow managed to find the need to respond to someone DARING to mention Haskell?
>>
>>56228477
>why don't you choose to program for android with Java?
Because I've been writing C# for half a decade now.

It's much easier for me to use since I'm already experience with C#.

If you're brand new, you might want to just go with Java.

By the way, if you're on Windows, both the two left options are the same; Xamarin is built into Visual Studio 2015. Xamarin Studio no longer exists on Windows.
>>
>>56228535
KILL YOURSELF KILL YOURSELF KILL YOURSELF

see >>56228540
>>
>>56228553
>IDIOT ... IDIOT
What's there to see?
>>
>>56228545
>So you're saying you're neither of the people I replied to?
Of course I am one of these. Considering your dumb replies that make no sense I can only conclude that you have some kind of brain damage.
>>
>>56228540
>>56228553
You said this:
>ol cuck it's not free at all they could shut it down or change the license and charge money at any time

That's a complete non-sequitur.

Any free project can shut down. That doesn't make it not free and open-source.

You're a fucking moron.
>>
>>56228557
stay delusional idiotic shart in mart microcuck
>>
>>56228557
he wasn't alone
>>
>>56228560
Nice response, you're clearly on the same level of intelligence as the other guy that replied. No substance, just talk.

Obviously you don't use C++ at all
>>
>>56228535
>>56228553
>>56228557
>>56228434
Don't reply to the carposter.
>>
File: v&.png (35KB, 475x122px) Image search: [Google]
v&.png
35KB, 475x122px
>>56228584
But can you do it before the police arrive?

>>56228477
Java/Android is horrible
>>
>>56228574
>Obviously you don't use C++ at all
I don't disagree, of course I do not use C++ but I did not post anything about C++ either.
What the hell is your problem? Why do you keep replying with absolutely unrelated shit to my posts?
>>
>>56228584
1110 3rd Avenue
Seattle, WA 98101-2904
(206) 622-0460

i'm waiting for you
>>
>>56228596
c#/xamarin is even worse you fucking retard

fucking look at the xamarin API it's like they took android and changed it from camelCase to PascalCase and that's it

KILL YOURSELF
>>
>>56228599
>completely unrelated
I thought you were the other guy, but what was your point?
>>
>>56228575
Really? Is the carposter still around?
>>
>>56228540
There are many people using Xamarin, if it happens to go unfree they'll just make freeXamarin or openXamarin or whatever. This is how many projects started, for instance OpenOffice to LibreOffice, NetScape to Firefox.
>>
>>56228614
Yes, this guy >>56228584
>>
File: 13yo simulator.png (19KB, 926x280px) Image search: [Google]
13yo simulator.png
19KB, 926x280px
>>56228608
There there, have you got it out of your system now? There's a good kid. When you're older, you won't be able to get by just on "KILL YOURSELF", so be strong and grow up into a real human being
>pic related (it's you)
>>
>>56228618
freetard shit is fucking trash you idiot, it will just be an even more pathetic layer on top of android
>>
>>56228611
I am this guy >>56228252 and made the rest of the child posts in that reply tree. None of my posts said anything about C++.
>>
>>56228618
The funny thing is, Xamarin wasn't free until Microsoft bought it.

It used to be $1000/year for licensing.

Microsoft acquired it, immediately made it free and open source, and pumped tons of money into the development teams.
>>
>>56228608
Weren't you just banned for posting illegal stuff, carposter?
>>
>>56228637
it's """"free"""" like any """"free"""" service is until they decide to monetize it or just kill it off
>>
>>56228636
There are plenty of functional languages with foreach

Haskell has traverse_ and forM_ and for_


ML and F# have List.iter
Plus in impure languages (including ML and F#), maps ARE foreach
>>
>>56228648
Anon, you must be confused.

They are already monetizing it and making a ton of profit...off of the large enterprises, not the indie devs.

They make money from the farms of mobile devices you can deploy and test your app on all at once. Large companies pay massive amounts of cash for this service.

In return, everyone else gets to use the toolset for free, and the toolset itself is open-source under the MIT license.
>>
>>56228637
Exactly, who knew that big corporations get rich by incentivizing developers to use their platforms.

>>56228635
Pajeet, i...
>>
>>56228667
>>56228676
have fun using lolxamarin which is literally just a layer on top of android with a language that is literally just a java clone (but it's better because it's "not java" amirite), not my problem lmfao
>>
>>56228686
>but it's better because it's "not java" amirite
I think you're starting to get it!
>>
>>56228694
stay delusional lmfao
>>
>>56228686
>but it's better because it's "not java"
Exactly
>>
>>56228700
nice meme shart in mart nathaniel
>>
>>56228686
>(but it's better because it's "not java" amirite)
Does having these types of realizations promote you to a better caste?
>>
File: javafag.png (28KB, 610x365px) Image search: [Google]
javafag.png
28KB, 610x365px
>>56228699
Maybe you should stop laughing your ass off and try re-evaluating your choice of programming language
>>
>>56228686
>but it's better because it's "not java"

C# is open source.
Xamarin is open source and builds upon the open source Mono.
Xamarin.Forms is open source.

Yeah, I think I'll stick with an open-source stack over Java, thanks.
>>
New thread: >>56228753
>>
>>56228744
>C# is open source.
A language can't be open source.
also, >replying to the carposter.
>>
>>56228755
>Literally 10 posts early
>>
>>56228755
>299 posts
???
>>
>>56228755
Do you think one day people will realize 310 is the bump limit?
Dumbass
>>
>>56228758
I'm obviously referring to the compiler and surrounding toolset.
>>
>>56228761
>>56228765
>>56228789
no worries we'll be at 310 soon with all these scrumptious (You)s
>>
parse alphabet str = foldr step 0 (reverse digits)
where
step a b = b*base + a
base = fromIntegral (length alphabet)
digits = map (fromIntegral . digit) str
digit c = maybe unknown id (lookup c table)
table = zip alphabet [0..]
unknown = error "digit not in alphabet"

binary = "01"
decimal = enum "09"
hex = enum "09af"
base64 = enum "AZaz09" ++ "+/"
zbase32 = "ybndrfg8ejkmcpqxot1uwisza345h769"

enum [] = []
enum (a:[]) = [a..]
enum (a:b:c) = [a..b] ++ enum c


*Main> parse decimal "1337"
1337
*Main> parse binary "101"
5
*Main> parse hex "ffffff"
16777215
*Main> parse zbase32 "fuck"
183690
*Main> parse hex "q"
*** Exception: digit not in alphabet
CallStack (from HasCallStack):
error, called at hex.hs:8:14 in main:Main
*Main>
>>
>>56228761
>>56228765
>>56228789
Typical carposter, he did that just so he could post the anti-C# propaganda and support his shitty* Java after he got raped in the anus in the discussion.

*Java is about as shit as C# but whatever, it doesn't matter for him.
>>
>>56228816
Whats this do?
>>
>>56228838
The interpreter session is right there.
>>
>>56228833
C# is about as shit as java if not worse

C# shart in marts are fucking pathetic, just because the language is not named java they think it's magically better and it makes them think they're better than java programmers lmfao
>>
>>56227241
Codingame is fun also, you can program against other programmers in real time
>>
New thread >>56228877
>>
REAL NEW THREAD: >>56228753
>>
>>56228542
Scheme is more functional than some ML dialects. I guess you could call it multi-paradigm since you can write imperative code in it, but it definitely pushes you less towards imperative code than CL does so I would consider it functional.

Then again, some people equate Haskell and Haskell only with functional languages, and argue that anything without a rigid type system isn't functional.

Imho, leaving side effects aside for a moment, if the standard way a language is used involves you having lots of explicit loops, it is procedural. If it encourages you to never ever use explicit loops, using maps, fold and recursion instead, it is functional. CL is the best example of a language which doesn't push you in either direction.
>>
>>56226859
Where can I apply my CV?
>>
>>56229387
>censoring the name of your WiFi
Why? Are you scared one of us walks by your house, scans all networks and recognizes you?
Thread posts: 317
Thread images: 44


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