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

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: 313
Thread images: 30

File: timetocode.webm (2MB, 1152x648px) Image search: [Google]
timetocode.webm
2MB, 1152x648px
This is /dpt/, the best subreddit of /g/

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

/!\ ** Read this before asking questions ** /!\

http://mattgemmell.com/what-have-you-tried/
http://www.catb.org/~esr/faqs/smart-questions.html

*** Discord ***
https://discord.gg/xkpCW


What are you working on ?
>>
>>57028549
Why are you posting proprietary chat software?
>>
>>57028575
why are you posting on a proprietary image board?
>>
File: anal beads.png (148KB, 1676x943px) Image search: [Google]
anal beads.png
148KB, 1676x943px
>>57028549
>What are you working on ?
Xamarin + Azure things

It just fucking Werkz™.
>>
>>57028594
Because there is no alternative.
>>
In sepples, can i populate a dictionary during compile time?
>>
>>57028614
yes
>>
>>57028621
How to do this, please?
>>
>>57028638
constexpr
>>
>>57028672
Please clarify with more detail and preferably a code example.
>>
>>57028614
no
>>
>>57028672
>constexpr
>map

no
>>
>>57028672
>constexpr with heap allocation
nah
>>
How should I implement a CPU emulator? Just a big-ass switch statement?
>>
>>57028893
jump table at least, pre-decoding at best.
>>
>>57028400
Someone should have told him about
_Thread_local
>>
File: 2016-10-11-122324_935x396_scrot.png (87KB, 935x396px) Image search: [Google]
2016-10-11-122324_935x396_scrot.png
87KB, 935x396px
Am I mentally retarded?

Like the fact I actually did this makes me feel really stupid.
>>
File: Untitled.png (60KB, 423x436px) Image search: [Google]
Untitled.png
60KB, 423x436px
>>57028989
it's ok anon, everyone makes mistakes
>>
>>57028893
GCC's computed goto. Allows you to take advantage of branch predictor to improve the speed of common n instructions pairs. Make sure you put the labels in a particular hot section. I'm not sure how much you know about assembly instruction design and function and how fancy you want to make it. Any idea of what you want yet?
>>
>>57028989
That's not dumb at all. The commented code only allows (silent!) redirection to selected URLs, but the new code will redirect the browser to any URL that an attacker might supply. Sure, you can consolidate the ifs into an array and one condition, but otherwise, they're not semantically equivalent.
>>
>>57028989
As expected from a PHP developer, following Rasmus' steps.
>>
Ok, i now know how to write a Hello World, and i know how to write an infinite loop in C++.
Now, how do i write a program that runs an infinite (or just many iterations) of a loop in the background, while returning control to the command line in the mean time, before execution is finished?
>>
>>57029055
Threads.
>>
>>57029065
"no"
>>57029055
fork, exec
>>
>>57029073
>fork, exec
>C++
retard
>>
>>57029055
#include <string>
#include <iostream>
#include <thread>

auto main(int, const char **) -> int
{
bool stop{false};
auto t = std::thread([&stop]() {
while (!stop) {
// cunt
}
});

std::string line{};
while (std::getline(std::cin, line)) {
if (line == "stop") {
stop = true;
break;
}
}

t.join();
return 0;
}
>>
>>57029089
I hope you're just pretending.
>>57029101
>return control to the command line
>>
>>57029101
You just did that to confuse her didn't you
>>
>>57029116
>>return control to the command line

I completely misread that part, in which case, what >>57029073 said, fork will do.
>>
>>57029101
>
auto main(int, const char **) -> int

kek'd, thanks anon
>>
>>57029073
>fork, exec
no
>>
>>57029101
>std::getline
use ADL for extra memery next time
>>
I'm trying to implement KNN search with KD-trees
Why is scipy's implementation so complicated?
I'm stuck at the part where I need to check if a hyperrectangle intersects with the estimated closest neighbor radius.
>>
>>57029101
>
auto main(int, const char **) -> int

>people do shit like this
>>
In the simple Hello World program, how is the memory being handled?

It is said, that C needs to claim memory and then give it back.

In the println('you do not understand what you cannot create'); I see nothing of that or am I wrong?
>>
>>57029325
Are you using any memory?
>>
>>57029325
use a disassembler like objdump --disassemble and see yourself
>>
>>57029352
>doesn't know about memory
>can read assembly
hmmm
>>
>>57029340
Uh, "of course" must be the answer, right?

>>57029352
Mhm.
>>
>>57029055
What you want is event based programming and it requires a totally different thinking.

man epoll
or the eventlib book give you a first impression.
>>
>>57029325
>how is the memory being handled
Pick up the book "Programming Language Pragmatics".
>>
>>57029373
I don't even.
>>
>>57029376
I've got The C Programming language from Ritchie, but the intro doesn't introduce the memory handling. Okay, thanks for helping me out, although I doubt that you really did that, because we're on /g/...
>>
>>57029365
>he cant learn about memory from looking up the assembly instructions he sees
use your brain anon
>>
>>57029411
"The C Programming Language" by K&R is a book to teach syntax to people who already understand how to program.
Trying to learn from a reference textbook is dumb. That's like learning a foreign language using a dictionary.
>>
>>57029055
Just use the shell.
$ while :; do :; done &
>>
>>57029431
Then it was made for me.

Thanks!
>>
Dumb question here:

I need an optional radio button input to be text. Like this:
<input type="radio" name="title" value="Option 1">Option 1<br>

<input type="radio" name="title" value="Option 2">Option2<br>

<input type="radio" name="title"value=***how can I make a text box here***?
>>
>>57029325
>It is said
Except it isn't, all programs do that, not just ones written in C.
>>
>>57029464
Keep in mind that it's old and outdated.
>>
>>57029476
<input type="radio" name="title" value="Other">Other (specify below)</input>
<!-- whatever handles your form ignores this input unless title=Other -->
<textarea name="other">Other option...</textarea>
>>
Why is the syntax of programming languages usually documented in ways that describe how to produce source code instead of how to parse it? For someone who wants to learn the syntax it makes not much of a difference but for someone who wants to write a parser the second version is much better.
>>
>>57029291
>Why is scipy's implementation so complicated?
How is it complicated? I'm reading the documentation right now and it looks fairly straightforward.

I've only implemented knn using the standard way of compute distance between training and each test, argsort, scrape off first k indices, argmax.
>>
>>57029530
shouldn't the textarea name=title?
>>
>>57029323
But, why?...
>>
>>57029602
Which language? Many of the syntax definitions I see for languages use BNF or similar format.
>>
>>57029633
no, it can be whatever you want, the name title is the radio button group
>>
>>57029668
>Many of the syntax definitions I see for languages use BNF or similar format.
That's what I said. BNF describes how to turn nonterminals into a sequence of terminals. But parsing is exactly the opposite.
>>
>>57029675
So there isn't a way to make the actual value of the radio button a text input? I just want it to say value="user specified option"
>>
>tfw when recoding from scratch
>>
>>57029722
Just create a radio box with empty value then create an input box next to the radio box.

Also fuck off to >>>/g/wdg
>>
>>57029722
are you willing to use javascript?
>>
>haskcucks will defend this
-- Does not time out after 3 seconds
timeout (seconds 3) (readFile "foo")

-- May print nothing or truncated result
do x <- withFile "foo" ReadMode (\h -> ... hGetContents h ...)
print x
>>
>>57029759
that won't work because it will just post blank data over all the other boxes that are checked
>>
>>57029842
get more creative you faggot
there's a simple way around it
>>
File: donald went ax crazy.png (55KB, 307x273px) Image search: [Google]
donald went ax crazy.png
55KB, 307x273px
>compiling a 10-year old program with the newest GCC with -Wall -Wextra -Wpedantic

So... many... warnings...

cppcheck also goes crazy with it. How the fuck did this program compile and work at all 10 years ago?

I haven't even turned on *all* the warnings I normally use these days. I'm afraid of what will happen if I run it in valgrind.
>>
>>57029896
what program
also maybe it was full of warnings to begin with but the devs never cared about them
pretty standard with open sores shitware
>>
>>57029896
What warnings do you normally use other than -Wall -Wextra -pedantic?
>>
>>57029842
>all the other boxes that are checked
its a radio button group, only one can be checked...

the normal solution is to have a radio button with a 'dummy' value and a textarea, not directly tied to the value posted by the form but on the backend test if the radio buttons were set to the dummy value and if it is use the value from the textarea instead.

The wtf-are-you-doing-but-everythings-possible-on-the-web-right!? solution is to use Javascript to trigger an event when text is entered in to the textarea to modify the radio button's .value to be the contents of the textarea

Either way it will still LOOK the same to the user, the textarea can be right next to the radio button.
>>
>>57029896
>not enabling all warnings and only disabling those you don't care about
you're asking for it
>>
Are there any open source p2p cdn solutions for static files like webms, images etc...?

exhentai/e-hentai has the HENTAI@HOME solution, a java application that runs in the background. But it isn't open source.

Why isn't this a thing?
>>
>>57029638
because templates
>>
>>57029703
Well the thing is you usually write BNF and use a parse generator so you don't have to do that shit by hand.
>>
>>57030049
>But it isn't open source

% head -n 2 LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
>>
>>57030049
>running closed source programs distributed by porn websites
I hope nobody does this
>>
>>57030092
That's not what happens though. Clang, GCC, rust, and go all use handwritten recursive descent parsers.
>>
>>57030096
I found it, except it's named hath.

>>57030098
It's open sores apparently.
>>
>>57030122
Yeah, after they have something already working... and I'm sure as soon as you are familiar enough with the language syntax you can do the same.
>>
File: 1472198695019.png (505KB, 600x400px) Image search: [Google]
1472198695019.png
505KB, 600x400px
What's a better way of making a simple calculator?

Is it a better idea to just parse the values entered by the user as a string or is it better to automatically fill the operands with values and immediately react to any changes performed by the user on them, e.g. backspace, decimal point?

I made a calculator doing it the second way and I feel like I've done too much unnecessary work.
>>
>>57030203
You tokenize the string and then parse that based on precedence.
>>
>>57029951
It's one of my own creations, a 3D engine + editor I wrote.

>>57029969
Here's something to get you started: -Wfloat-equal -Wshadow -Wformat=2 -Wformat-security -Wcast-qual -Wmissing-declarations -Wswitch-default -Wuninitialized

There's some new warnings in the newer GCC's I haven't yet fully explored, so the list will probably get longer soon.
>>
>>57030096
>>57030098
The GUI is java and open source (although, no build tool wtf).

The backend for the server is what I'm interested in as well.
>>
>>57030248
Isn't it slower?
>>
>>57030164
Here is the most trivial non-trivial grammar I can think of:

Expr:
Integer
Expr '+' Integer

Integer:
// ...


From this it is not clear how to parse an Expr. Naively you might write this:

parse_expr() {
expr = parse_expr();
if (peek() == '+') {
eat_plus();
expr = Expr(expr, parse_integer());
}
return expr;
}


Obviously this is infinite recursion. But in more complex grammars it is often not clear if a grammar is left-recursive via several levels.

And if the nonterminal can expand to a great number of forms it might be hard to even come up with an algorithm that parses it.

Here is the grammar in a form suitable for parsing:

Expr:
Integer ('+' Integer)*

Integer:
// ...


From this it's trivial to construct the parser:

parse_expr() {
expr = parse_integer();
while (peek() == '+') {
eat_plus();
expr = Expr(expr, parse_integer());
}
return expr;
}


This is much better. Every grammar should be written in such a form.
>>
>>57030252
>Here's something to get you started: -Wfloat-equal -Wshadow -Wformat=2 -Wformat-security -Wcast-qual -Wmissing-declarations -Wswitch-default -Wuninitialized
So, why aren't those in -Wall or -Wextra?
>>
>>57030273
It's the only correct way.
I'm not even sure what did you mean through your former method.
>>
>>57030279
Also I forgot: With BNF it's usually not clear if the grammar is ambiguous, that is, if the generated code can be parsed in multiple way.

If the grammar is written in a way then there can't be ambiguity because you already have a prescribed way to parse the source code.
>>
>>57030317
*if the grammar is written in a way suitable for parsing
>>
So I've read most of the c++ stl.. now what
>>
I didn't even realise how many warning flags GCC has. Some of them are quite interesting.
>>
>>57030303
>I'm not even sure what did you mean through your former method.
I made a calculator where you start typing in the number and then it immediately fills the first/second operand with the value, same with operator and then when you click equal/or some other operator it then performs calculations without parsing the string the user entered. So the program doesn't parse the input, because the input is already there in the variables. The area with numbers that the user sees doesn't even know about the actual variables with actual numbers the user entered.
>>
>>57030086
>templating main
But, why?...
>>
>>57030279
>left recursion
Retarded.
>>
>>57030404
There's a simple and intuitive deterministic algorithm for removing left recursion.
>>
>>57030298
No idea. Only GCC's devs can answer that.
>>
>>57030252
Here's a simpler one: -Weverything.
>>
>>57030203
My calculator, it even does operator precedence and parens!
alert(eval((p=>(/^[0-9()*/+-]+$/.test(p))?p:'"not vaild"')(prompt())))
>>
>parsing using anything but TDOP (Pratt)
>>
>>57030429
Yeah, but still. Bringing that up as an example is "look a case where thing is known to break is proof that it isn't sufficient!" is bullshit.

If you think you can come up with a better way to represent grammar then please write a paper on it. Writing syntax in the bottom up form doesn't really help one understand the language by looking at it. It's only good for someone like yourself trying to write a parser. But you aren't the only one who will need a syntax definition and why spend the extra effort for the three people who will ever try writing a compiler for the language besides the reference implementation? I think you are asking too much of others.
>>
>>57030342
Now you learn to tango.
>>
File: output.webm (3MB, 320x568px) Image search: [Google]
output.webm
3MB, 320x568px
Please r8 the new animations
>>
>>57028672
Working on constexpr?
Working on creating your own, or working on understanding, or what?
>>
>>57030488
Does that actually exist? If it does, does it include the sanitizers?
>>
File: image.jpg (187KB, 1280x720px) Image search: [Google]
image.jpg
187KB, 1280x720px
>>57028608
>Agree on a definition of OOP
OOP fags will never agree on that
>>
>>57030522
The heart and star icons still look horribly out of place, why haven't you made them in the same style as every other piece of the UI?
>>
>>57030584
Inheritance + Encapsulation
>>
>>57030611
I disagree.
>>
>>57030611
You don't need inheritance to code OO.
>>
If i'm not allowed to modify a state, what the fuck am i supposed to do with the return value of a function?
>>
>>57030670
Pass it into another function.
>>
>>57030670
Create new state.
>>
>>57030489
Cool, I was talking about a desktop application.
>>
>>57030685
So functional programming is just an infinite composition?
>>
hi guys, was working on this tricky fizz buzz problem earlier, that only very few people can solve, supposedly. is my code correct?
#include <type_traits>
#include <limits>
#include <iterator>
#include <algorithm>
#include <string>
#include <iostream>

template<typename T>
using integral_iterator_base_t = std::enable_if_t< std::numeric_limits< T >::is_integer, std::iterator<std::random_access_iterator_tag, T, std::ptrdiff_t, T, T> >;
template<typename T>
class integral_iterator_t : public integral_iterator_base_t<T>
{
using base_t = integral_iterator_base_t<T>;
typename base_t::value_type m_value;

public:
integral_iterator_t() = default;
integral_iterator_t( decltype( m_value ) const& value ) : m_value{ value } {}
operator auto const& () const { return m_value; }
operator auto& () { return m_value; }
typename base_t::reference operator* () const { return *this; }
};

int main()
{
using uint_iterator_t = integral_iterator_t<unsigned>;
std::transform( uint_iterator_t{ 1 }, uint_iterator_t{ 35 }, std::ostream_iterator<std::string>{ std::cout, ", " },
[]( auto const& value )
{
static std::string lut[] = { {}, "Fizz", "Buzz", lut[ 1 ] + lut[ 2 ] };
lut[ 0 ] = std::to_string( value );
return lut[ !( value % 3 ) + ( !( value % 5 ) << 1) ];
} );
}
>>
>>57030721
No?
>>
>>57030721
Yes.
>>
>>57030695
Sounds like om going to run out of memory sooner or later.
>>
>>57030721
Maybe.
>>
>>57030744
You can throw away the old state unless you want to do something with it as well.
>>
>>57030744
Sooner rather than later.
>>
>>57030721
Recursion can be tail-call optimized so it isn't necessarily composition.
>>
Anyone have any experience with C#'s office library (Microsoft.Office.Interop.*)? Trying to scrounge up some example snippets that uses the Inspector/ActiveInspector to return a currently-open Outlook email but this seems to be a hidden art.
>>
>>57030754
If i'm going to throw away the old state and replace it with a new state, isn't that practically the same thing as modifying the state?
>>
Trying to get more comfortable with threading.
>>
>>57030791
Yes. Mutation is an implementation detail. If things are set up such that it is a non-observable side effect, you gain great reasoning power.
>>
>>57030791
Yes, it would be silly to keep around all the old shit. What's your point?
>>
>>57030784
It's still abstractly a composition.
>>
I pulled my old e-yama 15' 4:3 TFT LCD from the attic so I can have multi monitor support. God, I love 4:3.
>>
>>57030805
>If things are set up such that it is a non-observable side effect, you gain great reasoning power.
It's funny you say that because Haskell, as the FP flagship is notoriously difficult to reason about and doesn't even have a formal specification. On the other hand, Standard ML, a strictly-typed imperative language with mutation, has a formal specification and even a couple formally verified implementations.

Checkmate fpcucks.
>>
>>57030833
Nigger did I say anything about a particular language?
>>
>>57030806
My point is that if i'm allowed to modify a state then i'm allowed to write the return value of a function to a struct.
>>
>>57030864
I was quoting
>If things are set up such that it is a non-observable side effect, you gain great reasoning power.
and disproving it.
>>
>>57030866
To save memory, yes. But you also have to prove that you aren't trying to use that same memory but expecting the object in its old state.
>>
>>57030876
Well I suppose you're not wrong but the things that are hard to reason about in Haskell aren't related to mutation. So I'm not wrong, either.
>>
julia-tan is my waifu now
fuck python
>>
>>57030728
What the fuck is that shit. I can sort of see what you are doing. Here is the easier way.
int main(void) {
char *lut[] = {"%d\n", "Fizz\n", "Buzz\n", "Fizzbuzz\n"};
for (int i = 0; i <= 100; i++)
printf(lut[(i % 5 == 0) << 1 | (i % 3 == 0)], i);
return 0;
}
>>
>Atom 1.11 features performance and stability improvements and, in particular, we’re excited that Atom now asks for permission before sending any telemetry data. :boom:
"excited"
>>
File: Selection_571.png (10KB, 362x105px) Image search: [Google]
Selection_571.png
10KB, 362x105px
>>57029878
>>
>>57030920
>we’re excited that Atom now asks for permission before sending any telemetry data
I can't even.
>>
File: Bcbb48cf13.jpg (137KB, 873x1170px) Image search: [Google]
Bcbb48cf13.jpg
137KB, 873x1170px
>>57030895
fuck you
we snek
>>
>>57030878
Easy.

Axiom: Ever object is expected to be in the state is found.

It follows from the axiom that no object is expected to be in any other state than it is => no object is expected in it's old state. Unless old state is equal to current state.
QED
>>
>>57030962
And that's throwing away reasoning power.
>>
File: mpv-shot0010.jpg (89KB, 1280x720px) Image search: [Google]
mpv-shot0010.jpg
89KB, 1280x720px
>>57030920
>we’re excited that Atom now asks for permission before sending any telemetry data
>>
>>57030611
What about polymorphism? What about the definition that it's about "state and behavious"?
>>
File: giphy(2).gif (2MB, 290x337px) Image search: [Google]
giphy(2).gif
2MB, 290x337px
posting through 3 virtual private networks and a proxy
>2012. Normal morning
>Having a sip of redbull while programming some hacker things you wouldn't understand
>I'm interrupted by animegirl.mp3
>"more mail huh"
>open tormail
>message from a skid called "j4Ys1n"
>"Hey gr3ênW1nD, I hear you're quite the hacker. Dare to duel? connect and lets battle: 127.0.0.1"
>urfuckingdonekid.xml
>attatch to his internet protocol
>his firewall is 40 kilobytes wide
>too long to go around
>butthatdidn'tstopme.qpu
>I furiously coded a ddos at 180wpm with my dvorak tactile keyboard
>DDOS COMPLETE. FIREWALL : DOWN
>check my security monitor
>he has already breached my firewall
>"shit, I need to go in hard"
>put on my mask, gloves, and shades
>play GITS soundtrack in the background
>raise my rolley chair
>im ready
>fingers now typing at 249wpm
>First things first, I need to take over his router for direct access to the pc
>with his firewall down I begin portforwarding all of his ports
>now with all the ports open I can send the virus I'll make later
>make my way into the mainframe
>I'm prompted for a password
>I ddos it in under 10 seconds
>decryption starting, 15 hours remaining
>I have no fucking time for this he could already be in my system
>I ddos the decryption as hard as I can
>2 hours remaining
>my face sweat is getting all over my hands
>all of the sudden, decryption drops to 1 hour
>I completely forgot
>water conducts electricity, speeding up the ddos electrons
>I turn my themometer up from 60 to 100
>I check the security monitor, hes decrypting my mainframe with only 30 minutes left
cont..
>>
>>57030978
That's why i'm using a machine to do my work for me. If i had that kind of reasoning power i wouldn't have to write a program at all. I'd just do everything in my head.

(No, i clearly don't understand functional programming at all.)
>>
>>57031000
>What about polymorphism?
I don't think polymorphism has much to do with OOP. You can even have objects without strong or static types.
>state and behaviours
Sounds like reactive programming.
>>
>>57031020
Reasoning power in terms of what you don't need to keep in your head, what can be machine-checked, what can be used by the compiler for optimizations, etc.

i.e. being more productive.
>>
>>57031015
l-lewd >.<
>>
>>57028989
>Am I mentally retarded?
No, because those two aren't the same. The first set is actually more secure (well, it would be if it returned a blank header).

PHP handles routing in a really bizarre way in general, millions of people have been tricked into thinking the whole .htaccess thing is a solution when it isn't.
>>
File: feynman.jpg (15KB, 269x312px) Image search: [Google]
feynman.jpg
15KB, 269x312px
I'm quite frustrated with my PhD studies in physics, and the bleak job market isn't helping at all.

My leet fortran programming and python scripting are't perhaps the most sexy skills in the market today. My skills are more in learning new stuff, managing large amounts of knowledge and synthesizing something new of the information.

How easy it is to get a relatively relaxed job doing web or software development? I have been learning some front-end stuff in the past months, and it seems quite enjoyable by far.
>>
>>57031015
Is this the sequel to Snow Crash?
>>
>>57031101
Quite easy. Since you're a physicist, I assume you're good at applied math, statistics, etc., so you might get a good job in data analysis, 'big data', perhaps machine learning. IMO that's a more interesting direction than webshit, but if you really want to go for that, you should be all right. It's really easy in general.
>>
>>57028549
I'm starting into java but I don't want to have a bloated IDE. So I basically got all the stuff ready but im wondering if there is something like http://yeoman.io/ for java, does mvm having something like "mvm new <project_name>"?
>>
>>57031130
good advice. in my field (math), data science or whatever you want to call it is the new offramp. it might take a few years to get to do something interesting but the hardest part is just getting an interview. if you have some connections the whole thing should be a triviality
>>
>>57031157
>I'm starting into java but I don't want to have a bloated IDE
Pick another language then.
>>
>>57031173
also you could look into
http://insightdatascience.com
it's free, although if you're onsite you're living somewhere quite expensive
>>
File: 1475771096421.jpg (1MB, 720x3230px) Image search: [Google]
1475771096421.jpg
1MB, 720x3230px
I stopped caring about Haskell when I was introduced to the concept of monads. What a crock of shit. If your program can only modify state by inventing a higher-order abstraction that can't exist, like some kind of programming deity, then you are fucking wrong and the language is flawed. Same for type checking that basically says "the correct type is whatever the correct type is". That's what the error message said transcribed to words, but god forbid if i wrote in down in English instead of the meme Haskell runes that GHC marks me wrong.

Haskell is logical and category theory never lies my ass. Haskell is just as flawed as any other """functional""" language.
>>
>>57031101
Even the most retarded developer gets hired in the Netherlands. No matter what field (web, embedded etc.) you're in.
Tensorflow is really hot nowadays. It's mostly used with Python and as a physics guy, is right up your alley.
>>
>>57031223
Gonna need source.
>>
>>57031223
Even the inventor of Haskell acknowledges that's it not a useful language.
>>
>>57031244
okay sounds good
anon will move
>>
I feel like shit /dpt/, I've been unemployed for a month and the one in-person interview I managed to get I missed this morning because I didn't set an alarm.

I just want to be employed
>>
>tfw to intelligent too give up the pursuit of a homotopy type theoretic programming language
>>
>>57031327
Sorry to hear that, Anon. What's your stack?
>>
File: vscode-java.0.0.1.gif (2MB, 958x528px) Image search: [Google]
vscode-java.0.0.1.gif
2MB, 958x528px
>>57031157
ah fuck got it,

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

was in the docs but for my defesne: there are like 3x things that could fall under the getting started category on that website. also a bit verborse for my taste, guess the memes are true.

>>57031185
>Pick another language then.

well i know what you mean but i recently found this one

https://marketplace.visualstudio.com/items?itemName=redhat.java

looks pretty sweet to me!

>>57031223
i know your pain about haskell error messages, try elm for contrast. its like haskell but done better and simpler.
>>
>>57031336
>tfw to inteligent too bothre with typed languages
>>
>>57028549
>want to join Discord
>don't want to potentially get doxxed due to my username that is common across many accounts
>>
>>57031282
My question then is, is there any functional language that is useful? Is the whole FP meme useless?
>>
>>57031353
>programming Java without an IDE

Don't get me wrong, I love VSCode for things like NodeJS and Python, but I would never do something like Java or C# without a full IDE.
>>
>>57031404
ocaml, F#
>>
>>57031101
>How easy it is to get a relatively relaxed job doing web or software development?

Pretty hard, actually.

Most places don't like to hire people that can do the job with 10% effort because they're likely to leave when a more challenging (and better paying) offer comes their way.

If you just started, most places won't have relaxing work because you have stuff to learn and get frustrated about.

In my experience, these positions are tended by managers who don't have a clue about what you do, so you can bullshit them that you're working and actually spend 10% of your effort for the whole job.
>>
>>57031404
One with compromises, like Scala, C++14 or JavaScript.
>>
>>57031399
get a new username then
>>
>>57031404
Haskell is useful, ignore the memes
>>
>>57031404
fb uses haskell
>>
>>57031434
Haskell is a meme.
>>
>>57031423
>JavaScript
>Functional
>>
>>57031423
>Scala
not even once
>>
>>57031404
Haskell is useful for supporting libraries to larger applications.

It's certainly not a good language to solely focus on, though.

In contrast, you could live your entire life only ever knowing Javascript dialects, or even only Java and still make lots of things.
>>
>>57031419
I write Java in Vim. Fight me.
>>
>>57031435
Was this supposed to be in favour or in detriment to haskell?
>>
File: jsfunc.png (14KB, 287x221px) Image search: [Google]
jsfunc.png
14KB, 287x221px
>>57031456
>>
File: 0xasd.webm (2MB, 1500x844px) Image search: [Google]
0xasd.webm
2MB, 1500x844px
i did it /g/

fuck yeah
>>
>Scalascript
>>
>>57031496
With an extremely loose use of the term "functional" just about everything is functional. C# and Java are functional if JS is.
>>
>>57031476
>Haskell is useful for supporting libraries to larger applications.
This is a tangent i'd like to learn something about.
To me it seems a complete mystery how one can write different parts of a program in different languages and get them to work together. How does one do that?
>>
>>57031496
That doesn't mean JS is functional, but that it supports the functional paradigm in certain constructs.
>>
>>57031497
what is happening
>>
>>57031483
The company that chose to wrote their entire backend in PHP
>>
>>57031244
>Even the most retarded developer gets hired in the Netherlands. No matter what field (web, embedded etc.) you're in.
Not to derail anon but can you share some insight into why this is? I've noticed other Dutch people say the same thing
>>
>>57031544
4chan?
>>
>>57031528
well, if you could turn Haskell into an executable, you could probably turn it into some kind of machine code library and link against it with C or C++.
>>
>>57031528
Language interop.

My co-worker generally writes back-end or supporting libraries in Python, and I use them in my C# projects.

It's quite common to use native Windows DLLs that are written in C++ in C# code.

Obviously, there's a certain amount of potential issues with doing that, but it's quite common to have various languages strewn around a larger set of applications.
>>
>>57031548
TL;DR there's a shortage on programmers.
You can get hired anywhere as long as you have the right papers and/or experience. You also have to be a smooth talker.
>>
>>57030489

That's.. beautiful, anon.
>>
>>57031341
I don't have a "stack" per se. I can do C, Java, Node/express/socket.io/angular, and Python.

I'm throwing applications at the wall and seeing what sticks
>>
>>57031575
I know it's common. I keep hearing about it.
I just have no clue how to do it.
>>
>>57031528
https://wiki.haskell.org/Applications_and_libraries/Interfacing_other_languages
>>
>>57031522

>Clojures
>map/reduce

It's functional on my watch.

>inb4 triggered hasklel fanboys
>>
>>57031634
What language?
>>
>>57031666
What language what?
>>
>>57031650
>>Clojures
xD
>>
>>57031650
>It's functional on my watch.
Whatever you say. I guess C# and Java are functional too.
>>
>>57030489
>not vaild
>>
Been trying to learn Haskell, currently trying to add JSON parsing.
How do I implement the FromJSON for SData?
data SType = ST1 | ST2 | ST3 | ...
deriving (Show, Eq, Ord, Generic)
instance JSON.ToJSON SType
instance JSON.FromJSON SType

newtype SData = SData (M.Map SType Double)
deriving (Show, Eq, Ord, Generic)
instance JSON.ToJSON SData where
toJSON (SData m) = JSON.toJSON $ M.toList m
instance JSON.FromJSON SData where
parseJSON = ???
>>
>>57031575
>My co-worker generally writes back-end or supporting libraries in Python, and I use them in my C# projects.
sounds painful
>>
>>57031680
Every language handles interop with other languages differently, as far as using the libraries directly in the code goes.
>>
>>57031694
asm is the functionalest
>>
>>57031697
Crap, I knew I spelled it wrong. English is a crappy language, why have seperate pronounciation and spelling?
>>
>>57031702
there'll be an article on it somewhere, but i'm pretty sure it just uses applicatives
>>
>>57031702
>>57031754
in fact you can probably do something like

parseJson = SData <$> parseJson
I think there's an instance for some kinds of Map
>>
>>57031716
Ok, but from which side do you approach it. From the calling language or the called language?

>>57031736
Most of the retarded spelling in english seems to be due to pollution from french.
>>
>>57031736
you pronounced 'valid' as 'vaild'? wut
>>
>>57031736
>why have seperate pronunciation and spelling?
because it's a troll language to piss off people from shit countries who have to learn it.

In saying that, "valid" is pronounced exactly how it is spelled.
>>
>>57031794
The calling language, usually.

For example, I can call a .py file in C# code, reference a specific function, and retrieve the value that Python calculates as an object in my C# code.

The Python code didn't need to be made to interop with C#; C# just needed to be capable of interpreting the output of the function.
>>
>>57031575
>python backend
fucking hell m8
>>
>>57031840
But how is C# able to do that?
>>
>>57031705
>>57031934
It's not that bad.

There's very few Python scripts, and they do simple things or return really basic information about various things on our systems.
>>
>>57031953
You can go about it a few different ways.

Either just call the python interpreter and get it to do the work while you just parse in the output, or use IronPython.

IronPython does some pretty cool interop between C# and Python, and is usually my go-to solution.
>>
>>57031982
>Either just call the python interpreter and get it to do the work while you just parse in the output,
This sounds like an ugly dirty way of doing it.
>>
File: anal beads.png (108KB, 857x717px) Image search: [Google]
anal beads.png
108KB, 857x717px
>>57032023
It is.

That's why IronPython exists.
>>
File: image.jpg (58KB, 518x750px) Image search: [Google]
image.jpg
58KB, 518x750px
>>57031834
>troll language
Troll language indeed.

http://ncf.idallen.com/english.html
>>
File: err.png (10KB, 601x150px) Image search: [Google]
err.png
10KB, 601x150px
>>57031778
That gives me this error, can't really make sense of it.
From what I've read in the documentation so far the predefined aeson parsers for Data.Map only work if your map uses String or Text as key.
>>
>>57028549
>The instant invide is invalid or has expired.
>>
>>57032053
Ok, but how does it work?
>>
>applied to a metric fuckton of jobs on dice in one go
>used a cover letter template that's changed slightly for each application
>forgot that the template uses indeed.com as the default job site reference

fadk.lfadsljfahslj
>>
>>57032076
>Expected: JSON.Value → Map SType Double
>Actual: JSON.Value → Parser a
is what you should be looking at
>>
>>57031497
noice

i see a controller, and modules in assembly, but what's the purpose actually? emulation? simulation of circuitry? a game?
>>
File: haha-oh-man.jpg (22KB, 533x477px) Image search: [Google]
haha-oh-man.jpg
22KB, 533x477px
>>57032111
>>
>>57032109
not familiar with IronPython but in this case it appears to be an actual implementation of Python for .NET, in the way you have Python for Windows or Python for Linux, etc.

>>57032023
If they're saying literally just run python and parse the processes text output, then yes that's horrible but simple.

You could also interface with the Python library (so basically interfacing with C) and run an interpreter like that, which is more sane but for tiny little programs could be more effort to set up than the horrible method.
>>
>>57031497
What kind of visual assembler shiz is this?
Never seen it before.
>>
File: g challenges 3.png (421KB, 3840x2160px) Image search: [Google]
g challenges 3.png
421KB, 3840x2160px
Does anyone have the v4.0 of this chart?
>>
>>57032292
>list ranges from 000 to 228
what did they mean by this?
>>
>>57032323
its a precondition that you be able to at least write a random number generator to pick a challenge, rolling is deprecated
>>
>>57030488

Only on Clang.
>>
>>57032289
>>57032123
>>57031543
That's a new video game made by the creators of TIS-100. I think they're named Zactronics or something.
>>
>>57032398
GCC has lost the diagnostics game.
>>
>>57032599

It has mostly gone crazy with all the options possible you can put in.

Diagnostics, yeah, it most likely lost with how not intuitive it is to add every option in. But if you are willing to go insane with optimization, Clang can't beat GCC yet there with all the optimization options GCC offers.

Also, good news. Modern C got updated.

http://icube-icps.unistra.fr/index.php/File:ModernC.pdf
>>
>>57032658
Only yesterday we had a meme benchmark in which Clang (-O2) beat GCC (-O2) by a significant margin.

#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>

size_t avg_fast(size_t n, const size_t v[static n])
{
assert((ssize_t)n > 0);

size_t lo = 0, hi = 0;

for (size_t i = 0; i < n; i++) {
hi += __builtin_add_overflow(v[i], lo, &lo);
}

if (hi == 0) {
return lo / n;
}

size_t val = 0;
for (size_t i = 0; i < sizeof(size_t) * CHAR_BIT + 1; i++) {
val <<= 1;
val += hi / n;
hi %= n;
hi <<= 1;
hi += (ssize_t)lo < 0;
lo <<= 1;
}

return val;
}

#define N 50000000

int main(void)
{
size_t *vals = malloc(sizeof(*vals) * N);
for (size_t i = 0; i < N; i++) {
vals[i] = SIZE_MAX;
}

struct timespec start, end;

clock_gettime(CLOCK_MONOTONIC, &start);

size_t res = avg_fast(N, vals);

clock_gettime(CLOCK_MONOTONIC, &end);

printf("%lu\n", res);
printf("%lu\n", SIZE_MAX);

long mus = (end.tv_sec - start.tv_sec) * 1000000 +
(end.tv_nsec - start.tv_nsec) / 1000;

printf("in %ld microseconds\n", mus);
}


GCC: 92465 microseconds
Clang: 56380 microseconds
>>
>my project builds perfectly fine with -Wall and -Werror
>want to add a single header C library to it
>warnings all over the place

why the fuck C programmers are so incompetent
fucking idiot bunch
>>
>>57032709
It's within the same order of magnitude.
>>
>>57032736
Not if you go base 2.
>>
>>57032745
Yes, actually. Good job.
>>
>>57032745
Check again.
>>
>>57032766
>>57032778
In any case an almost 2x slowdown is nowhere acceptable. The problem is that GCC fails to funroll the tight loop.
>>
Why is the println statement in the for loop being completely ignored?
while(a<4) {
for(b = 4; b < 0; b--) {
a++;
out.println("b is " + b);
}
b = b + a;
a = a + b;
}
>>
>>57032710
CAN'T HAVE SPEED WITH RESTRICTIONS
>>
>>57032838
Look at your condition. Look at b's value at the beginning of the loop.
>>
>>57032838
System.out senpai
>>
>>57032709
>92465 microseconds
>microseconds
who the fuck does benchmarking on such tiny time frame ?
>>
>>57032890
Professionals
>>
>>57029101
Not gonna work.
Compiler is allowed to optimize that loop in the thread to while(1).
Need to make it atomic, or better; use std::atomic_flag
>>
>>57032658
>http://icube-icps.unistra.fr/index.php/File:ModernC.pdf
Looking at the index I think the author recently proposed his "const register = compile time constant" to the committee. I thought the proposal was pretty flawed when I read it but I can't remember now in which ways.
>>
>>57032870
shit. completely missed it.
thanks.
>>
>>57032885
Are you declaring a senpai of type System.out?
>>
>>57032895
Servers are much cheaper unless you have huge amounts of users.
>>
>>57032936
>unless you have huge amounts of users.
like is said. professionals.
>>
>>57032960
I mean huge.
>>
>>57032905
>or better; use std::atomic_flag
why

Captcha: Calle

every single day I get 10 calles
>>
>>57032895
No. under one second, benchmarking on multi tasking OS are too much biased by the others running tasks. it can also be biased by ram recharges. what benchmarks have you wrote ?
>>
>>57032912

It's not really flawed as in it repurposes something both compilers and programmers are rarely using if they even are.

I mean, you could just put these semantics in a new keyword, but I mostly agree with the proposal as it adds a more sane const/constexpr to C and what code his proposal breaks would be very little and there wouldn't be any loss with register not working the old way as register is a qualifier keyword.
>>
Guys, in C++ nowadays there's this thing that lets you initialize members like this without a constructor:
struct Something {
int a = 0;
};


What is this called? I wanna look it up to find out if using initializer lists there is defined. It compiles with int a{0}; but I wanna make sure that this isn't an indeterminate value or some undefined behavior.
>>
How did you learn assembly?
Has anyone some good resources?
>>
>>57032987
The committee hasn't shied away from adding new keywords in C11. Especially since the complete _Uppercase namespace is free. In any case I wasn't concerned with the usage of the register keyword but with something else. Guess I'll have to reread it.
>>57032983
Don't worry. I ran it multiple times and got consistent numbers. If you think one second is a reasonable lower bound then you don't seem to be aware how fast processors are nowadays. I can consistently benchmark a call to clock_gettime to take between 28 and 31 nanoseconds on my system.
>>
>>57033028
{ 0 } is the correct way. { } is called the universal (?) initializer for a reason. It works almost everywhere.

Captcha: Calle
>>
>>57033028
It is. http://www.informit.com/articles/article.aspx?p=1852519
>>
What IDE should I use to write verilog?
>>
File: 1475384715184.png (30KB, 747x491px) Image search: [Google]
1475384715184.png
30KB, 747x491px
>School isn't challenging whatsoever
>Pick back up my spanish and german learning
>Throw in Esperanto for giggles
>Feel pretty good that I'm not idly browsing all the time now
>Realize I still haven't written any personal projects in months
>Still can't summon the willpower because no potential projects feel pragmatic to write
Es fühle mich nicht gut
>>
>>57033028
>What is this called?
in-class initializer
>>
>>57033102
>>Still can't summon the willpower because no potential projects feel pragmatic to write
I'm in this situation. I've noticed that if I get drunk I can get motivated enough to write a really small project. Too bad I don't like alcohol.
>>
What best languge fo begin?
>>
>>57033154
Go
>>
>>57033157
Fuck off shill
>>
>>57033102
You have no time to write personal projects because you need to learn German.
>>
>>57033142
It's a shame I'm trying to stop drinking so much.
Not like I can't write a line to save my life when I'm trashed anyways

>>57033154
Any of them. If you plan to actually program things, learn C. Avoid Java, it teaches a lot of garbage habits.
If you just need it for some scripts to crunch lots of data easily, I.E. If you're a chemist or biologist or w/e and you just need some sloppy computing power, Python or Ruby
If you want to do Webdev, Javascript then Node.JS or Angular.JS (maybe ruby or python later)
>>
>>57032823
Yeah, I've noticed that GCC has been failing certain optimization that Clang/LLVM can do. Any idea why? Is it a time constraint? Does GCC know something that Clang does not? Is it a failure of the IR? Here is another example where GCC doesn't quite figure it out. It was from a test question I had last year.

#include<string.h>

/* reorder memory
*
* currently: u16, u16, u8, u8, u8, u32, u32
* new: u8, u8, u8, u16, u16, u32, u32
*/
void test2(void *dest, void *src) {
char temp[15];
char *d = dest;
memcpy(temp, src, 15); // might alias
memcpy(d, temp+4, 3);
memcpy(d+3, temp, 4);
memcpy(d+7, temp+7, 8);
}


GCC 6.2:
test2:
mov edx, DWORD PTR [rdi+8]
mov rax, QWORD PTR [rdi]
mov DWORD PTR [rsp-16], edx
movzx edx, WORD PTR [rdi+12]
mov rcx, rax
mov rsi, rax
mov QWORD PTR [rsp-24], rax
mov DWORD PTR [rdi+3], eax
shr rcx, 32
shr rsi, 48
mov WORD PTR [rdi], cx
mov BYTE PTR [rdi+2], sil
mov WORD PTR [rsp-12], dx
movzx edx, BYTE PTR [rdi+14]
mov BYTE PTR [rsp-10], dl
mov rax, QWORD PTR [rsp-17]
mov QWORD PTR [rdi+7], rax
ret


Clang 3.9:
test2:                                  # @test2
mov eax, dword ptr [rdi]
mov cl, byte ptr [rdi + 6]
mov byte ptr [rdi + 2], cl
movzx ecx, word ptr [rdi + 4]
mov word ptr [rdi], cx
mov dword ptr [rdi + 3], eax
ret
>>
>>57033098
What do you need it for? Just simulations, or fpga?
>>
File: 1472935884094.png (3KB, 430x373px) Image search: [Google]
1472935884094.png
3KB, 430x373px
>>57033208
Ich kann hilf es nicht dass mein Deutsch ist scheiße :(
>>
>>57033218
Huh, that clang code is pretty neat.
>>
>>57033276
nazis out
>>
>>57033276
go back to pol you fucking nazi
>>
>>57033102
Ich habe Deutsche fur drei Jahren gelernt, und es ist sehr gut.

I have a decentralized TV project in C++ i'm working on. If you want to help, hit me up on Tox at B183A4A9CC9E026DF4345EA31ACBE185ECA39656210F38736BBED62AD68DCF4F7E08A5D9960E
>>
package hello;

private class Hello {

public static void main(String[] args) {
System.out.println("Hello dpt friends!");
}
}
>>
>>57033438
hello Java new fag
>>
>>57033390
>>57033290
>>57033276
Ich fehle nicht wichtig, denn ich habe keine umlaut
>>
>>57033447
Well, I know more than this; just wanted to say hello to dpt friends.
>>
File: playing as a girl.png (147KB, 798x597px) Image search: [Google]
playing as a girl.png
147KB, 798x597px
In SQL, how do I create variables to use later?
I need to delete rows from a table that show up in another table.
>>
>>57033450
>Ich fehle nicht wichtig
What did he mean by this?
>>
>>57033457
printfn "hi"
>>
>>57033450
Is it just me or are these German sentences wonky af, I'm no expert at german or anything

Aber warum schreibst du überhaupt auf Deutsch?
>>
>>57033604
They look pretty normal to me. I guess a lot of the wonkyness.

Ich habe eine Sprechen fur HS gemussen.
>>
>>57033559
Learn how to SQL - joimts and everything.
>>
>>57033699
>Ich habe eine Sprechen fur HS gemussen.
Is this a joke?

It's either supposed to be:
>Ich musste ein Sprechen für HS lernen.
for if you still have to do it for HS (meaning you're still in HS), or this if you're no longer in HS but had to do it for it:
>Ich habe ein Sprechen für HS lernen müssen.
>>
>>57029755
>built from the ground up
>>
>>57033764
Isn't it Sprache = language and Spreche = speak(ing)
>>
>>57033764
>>57033764
>Ich habe eine Sprechen fur HS gemussen.
wasn't my best subject, and it has been a while
>>
For object oriented programming, all you need is objects.
>>
>>57033849
>>57033699
*Sprache
my bad
>>
>>57033849
Didn't catch that, you're right. It should be "eine Sprache"
>>
>>57033764

Don't you mean

>Wir mussen die Juden ausrotten

?
>>
>>57034034
No, I mean
>Wir müssen die Juden ausrotten.
>>
>>57034034
>>57034052
>not posting the Spanish version
https://www.youtube.com/watch?v=LnF1OtP2Svk
>>
>>57034266
>303 posts
fag
>>
>>57034391
>wahh i can't post my animu
webcuck.
>>
>>57034398
>wahh I need to have my shitty image as the OP even if it means shitting up /g/ by posting a new thread while this one is perfectly good
>>
>>57034266
>>57034391
>>57034398
>>57034484

Whatever you both are fags
>>
File: 1475260824437.jpg (92KB, 960x640px) Image search: [Google]
1475260824437.jpg
92KB, 960x640px
shieeeet dem janitors
>>
>>57034700
Don't make threads before the bump limit then.
>>
Mods are faggots.
>>
File: 1458848275120.png (3MB, 1856x2348px) Image search: [Google]
1458848275120.png
3MB, 1856x2348px
>>57034711

Whoever complains about the image is a fag.

Snitching, samefaggin, complaining and shitposting is
what dem weebos and anti-weebos do. They contribute
nothing to this already dying general.

/prog/ was better
>>
New thread:
>>57034830
>>57034830
>>57034830

Actually posted after bump limit edition.
>>
>>57033863
Shut the fuck up, Austin.
Thread posts: 313
Thread images: 30


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