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

/dpt/ - Daily Programming Thread

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

Thread replies: 322
Thread images: 38

File: 1484999974726.gif (168KB, 640x400px) Image search: [Google]
1484999974726.gif
168KB, 640x400px
What you working on, /g/?

Old thread: >>58700979
>>
fuck you for posting an anime image
>>
File: 1459101855127.jpg (26KB, 635x356px)
1459101855127.jpg
26KB, 635x356px
>>58704707
thanks for using an animation
>>
sml or ocaml?
>>
>>58704725
>>
>>58704737
Why not Haskell?
>>
>>58704805
>pure
eww
>>
>>58704737
Rust
>>
>>58704867
Looking for actual language and implementation instead of HIPSTER SHIT OF THE WEEK
>>
>>58704892
Then learn Haskell.
>>
>>58704911
>>58704838
>>
thank you for posting an anime image
>>
File: 1483035918361.png (786KB, 1000x1300px) Image search: [Google]
1483035918361.png
786KB, 1000x1300px
Kind of a noob question, but maybe someone can help me. When I type in a URL on Firefox:
https://someurl.com/stuff?key=API_KEY&text=foo&info=bar

I get the response that I was expecting: code 200 and the information I requested.

However when I type the exact same URL on curl in the terminal, as in:
curl https://someurl.com/stuff?key=API_KEY&text=foo&info=bar

It gives me code 500 and doesn't fetch the information that I needed. What gives, am I doing something wrong?

What is it that Firefox is doing to get a different response than curl?
>>
>>58704957
>What is it that Firefox is doing to get a different response than curl?
sending a referer
>>
>>58704967
i'm retarded, i meant user agent, not referer, and other headers.
>>
>>58704980
Thanks! I'll find out which extra headers Firefox is sending and put them on curl and see if it solves the problem.
>>
>>58704957
If this was the system I'm working on, it wouldn't work because we use a session header to authorize your requests.
>>
Halp plz.

>>58698904

What component is that, the black block with red top sections, bottom-left of the breadboard?
>>
>>58704707
C or java?
>>
>>58705183
Looks like switches of some kind.
>>
>>58704892
rust isn't hipster shit of the week, far from it
few other languages have dared to bring features from functional languages like tagged unions and pattern matching and also fill the C/C++ systems programming niche
>>
Am I cute, /dpt/?
>>
>>58704957
Not programming
>>
Is perl dead?
>>
>>58705397
It was never alive.
>>
>>58705376
>rust isn't hipster shit of the week, far from it
Right, it has passed the "hipster" part and has now arrived at being just "shit".
>>
File: 1484525100634.jpg (18KB, 291x343px) Image search: [Google]
1484525100634.jpg
18KB, 291x343px
>>58705387
>python
don't
>>
literally NOWT wrong with python
>>
>>58705441
Let me guess, you're a Python/JS babby?
>>
C
Python
Javascript
Java
SQL

is this everything a programmer needs?
>>
File: 1472992000448.jpg (79KB, 874x677px) Image search: [Google]
1472992000448.jpg
79KB, 874x677px
whats the deal here... if i omit "while(cin..." and set x and y values to 1.01 and 1.02 inside the function, i get "faggets", but if try to read in x and y, entering 1.01 and 1.02 using "cin", i get "balls".
>>
>>58705397
Perl 6 is kinda being developed, but it broke compatibility with Perl 5, so I dunno what to except.
>>
>>58704707
http://ubiquity.acm.org/article.cfm?id=1513451

>>58704725
this

>>58704737
Go (golang)
>>
>>58705472
Take out Python

>>58705456
Poor performance
Crippled lambdas
Stupid scoping
GIL
Dynamic typing
>>
>>58705481
>Go (golang)
Fuck off, shill
>>
>>58705472
>no functional language
Have fun being obsolete within 20 years.
>>
File: gol.webm (3MB, 500x500px) Image search: [Google]
gol.webm
3MB, 500x500px
got my game of life working, now i need to add stuff to it
>>
>>58705501
Java has lambdas, that means it's functional, which is great because it means millions of programmers won't have to put in the effort of learning a new language DO YOU THINK I SOUND BITTER THAT THESE LAZY FUCKS ARE ALLOWED TO PROGRAM WELL YES I AM
>>
>>58705486
>poor performance
not as if you'd notice for most applications
>crippled lambdas
hobson's choice
besides they are closer to the head.body concept
>stupid scoping
alternative?
>GIL
ok
>dynamic typing
mypy, typing annotations and the typing module basically make python a statically typed language when needed
>>
>>58705499
fuck off contrarian, go has it's niche
>>
>>58705486
Add indentation as code blocks.
>>
>>58705550
>not as if you'd notice for most applications
I do notice though

>hobson's choice
No, there's a better choice, which is to have good lambdas instead of shit ones

>alternative?
The way practically every other mainstream language does it?

>basically make python a statically typed language when needed
HAHAHAHAHA maybe if I glue a dildo on my car seat I can get away with not using a car with an airbag or seatbelt too
>>
>>58705597
>I do notice though
Tell me your story.
>>
>>58705557
>its
FTFY

Also, go has no niche, it's a language straight out of the 1970s. Jesus fuck I mean look at how you pull external dependencies into a project in it. Also no generics, interface{}, returning products when it should be returning sums, the list goes on. It seems to want to be a systems language but it has GC, for fuck's sake.
>>
I should learn Perl in 2017?
>>
i tried using a load store architecture in BasicTVs console to improve scripting and it is, by far, the most infuriating experience. Going to add interpreting command line parameters as temporary registers and hopefully I can play some music.

On the bright side compile times got a lot faster
>>
>>58705608
Every time I've rewritten some Python code in Java at work I've seen a speedup. Ten minute jobs down to three minutes.
>>
>>58705653
Because you probably don't know how to develop properly in Python.
>>
>>58705520
Not enough seizures.
>>
>>58705653
https://benchmarksgame.alioth.debian.org/u64q/python.html
>>
>>58705637
Make yourself knowledgeable, but now Python is top today.
>>
Is it worth it putting a simple graphical calculator and such on Github when I'm searching for my first programming related job as a java monkey.

I guess any displays that I can do different things are meaningful?
>>
>>58705671
Wasn't me who wrote the Python code.

But that's a real shit argument anyway, one of Python's selling points is that it's easy to use, you can't just say "hurr well you're just not good enough at it" whenever somebody has a complaint.
>>
>>58705597
how are you going to get better lambdas without braces (you aren't). lambdas are crippled anyway, they don't have docstrings or type annotations, so why not just define a function inside the function instead?
>The way practically every other mainstream language does it?
you mean, the way python does it (globals and locals)?
>maybe if I glue a dildo on my car seat blah blah
Non-argument
>>58705628
go's niche is concise, lightweight concurrency.
>look at how you pull external dependencies into a project in it
it better suits the way developers work nowadays with distribution by vcs repo and it keeps only one copy of each library which is more space efficient than cargo, venv, etc
>no generics, interface{}
ok
>returning products when it should be returning sums
?
> It seems to want to be a systems language but it has GC
i agree that go shouldn't really be called a systems programming language but it is fine for servers, microservices or small command line utilities
>>58705653
try pypy
>>58705637
nah
>>
>>58705540
You need more than lambdas to be functional.
>>
>>58705540
>language allows mutable state
D R O P P E D
>>
>>58705700
It's easy to use which is precisely why so many people never bother to learn how to write performance critical software in it.
>>
>>58705702
>concise, lightweight concurrency
Erlang is better

>how are you going to get better lambdas without braces (you aren't).
Maybe ditch that non-feature (no braces), then?

>why not just define a function inside the function instead
Why not just pass around function pointers and argument pointers instead?
>>
File: devicedrivers_js.png (192KB, 519x678px) Image search: [Google]
devicedrivers_js.png
192KB, 519x678px
>>58705732
>bothering to learn how to write performance critical software in python
>>
>>58705732
If you're writing performance critical software in a dynamically typed language with a garbage collector then you're doing it wrong.
>>
File: 1485430784946.jpg (33KB, 400x400px) Image search: [Google]
1485430784946.jpg
33KB, 400x400px
>>58705702
>how are you going to get better lambdas without braces
And after that the same people will tell me how Python is cool without braces.
>>
File: 1463323780506.jpg (61KB, 650x648px) Image search: [Google]
1463323780506.jpg
61KB, 650x648px
What am I don't wrong guys?

The code compiles without warnings/errors.
>>
>>58705732
>performance critical
>interpreted

Pick one
>>
>>58705784
But putting in braces is HAAAAAAAAAARRRRRDDD
>>
>>58705653
A three times speedup is pathetic.

Python should be around thirty times slower than Java.

You'd get a vast improvement in performance if you just changed algorithm rather than language.
>>
>>58705761
Erlang is not concise at all. It's javaesque in its verbosity. Which is why Elixir was invented.
>>
File: ipZuBNl.png (10KB, 839x293px) Image search: [Google]
ipZuBNl.png
10KB, 839x293px
Does anyone know what these kind of tag things are called and how I would make this work in a Windows form?
>>
>>58705767
>>58705774
>>58705790
No, not at all. Python has many benefits that would tip the scales in its favour. One of them is precisely the fact it's an interpreted language.
>>
>>58705798
That three minutes is mostly IO, not much I can do about it.
>>
on retrospect why would you even bother with writing performance-critical programmes in python? different languages are useful for different things. i use python for 10-line scripts, that's what it's useful for.
>>58705761
>Erlang is better
erlang has a higher cost wrt the runtime, the compiler, but it has still a different niche where reliability is required.
>Why not just pass around function pointers
Non-argument
>>58705784
Non-argument
>>
>>58705808
Fair doolies then.
>>
>>58705807
>Python
>scales
Is this some kind of joke?
>>
>>58705816
>can't think of a counter-argument
>n-not an argument!
>>
File: 1485135642832.jpg (246KB, 400x800px) Image search: [Google]
1485135642832.jpg
246KB, 400x800px
>>58705816
>Non-argument
Non-argument.
>>
>>58705807
>interpreted language
>performance critical
>>
>>58705831
>>58705836
so here we are, non-arguments reduce to non-arguments reduce to nothing.
>>
>>58705849
IT ALL RETURNS TO NOTHING
I JUST KEEP USING SHIT LANGS
USING SHIT LANGS
USING SHIT LAAAAAA-AAANGS

IN MY HEART OF HEARTS
I KNOW THAT I SHOULD STUDY C AGAIN
>>
Is it just me, or has thread quality dipped significantly this weekend?
>>
>>58705786
pls anons
>>
>>58705473
nvm guys, solved it
>>
File: d.gif (18KB, 152x184px) Image search: [Google]
d.gif
18KB, 152x184px
Can someone help me out pls

>>58705804

tank u
>>
>>58705849
Non-argument.
>>
>>58705848
Heh, I see you know well your /g/ memes.
>>
>>58705935
not an argument
>>
>>58705954
I do enjoy this meme.
>>
thought of learning lua but i bet /dpt/ hates lua as well
>>
>>58705807
Please explain how using a non-deterministic (for running time), garbage-collected, interpreted language is beneficial for performance critical tasks.
>>
>>58705982
>array indices start at 1
dropped
>>
>>58705995
You must learn already - the only acceptable language are Haskell and Lisp.
>>
>>58705982
Lua is great and beats most other languages if you need a really simple and tiny embedded language. It's not bad to know it and it's fairly widely used but it's not a "popular" language at all. Some of its features like metatables and coroutines seem a bit outdated and are improved on in pretty much every other scripting language though.
>>
>>58706013
Fortran starts array indices at 1 as well.
>>
File: tssssssh.jpg (29KB, 400x400px) Image search: [Google]
tssssssh.jpg
29KB, 400x400px
>>58706030
>the only acceptable language are
>>
>>58705982
I think Lua is cool
>>
>>58706059
Oh.

I guess we should start shilling for Lua, then.
>>
>>58705995
Python fits well in applications that involve dynamic creation of scripts/profiles/settings/etc. Lots of software uses some sort of mini language for the task, but that's not always a viable option.
>>
>>58705982
Lua is fucking based if you are going to interop with C, or any other language for that matter.

Just don't expect wonders when it comes to low level-stuff e.g. lack of a rounding built-in. It has floor and ceil, sure, but that's not the same.
Also if you rely on print formatting to do the rounding for you, it uses bankers rounding.

You just have to be prepared to do a few more things yourself.
>>
File: 1484175671989.png (355KB, 555x770px) Image search: [Google]
1484175671989.png
355KB, 555x770px
>>58706051
Explain yourself.
>>
>>58706079
Literally bash or powershell.

Why add fucktons of dependencies for a job you should be doing with built-in tools?
>>
File: post.gif (665KB, 500x280px) Image search: [Google]
post.gif
665KB, 500x280px
>>58706093
>>
>>58706101
Bash is shit, and also bloat. If it's not a kernel module it's not "built in"
>>
>>58706101
Bash and powershell are both less powerful, slower, and much more obscure. They are not up for the task.

Okay, imagine you work at CERN and the scientists there wanted you to write a particle accelerator tester. The idea is that you've got a database of commands and you have to develop an application that when supplied a set of instructions, e.g. accelerate a positron to 2GeV, it can execute them and verify the output. Python would be good here because the set of instructions can be supplied as a script and you don't have to develop a mini language just for it.
>>
>>58706159
bash and powershell maybe but i'd wager that dash is faster just because of how much time and effort has been spent speeding up linux boot times and shell performance in general.
>more obscure
utter bullshit.
>>
>>58704740
What's with your font rendering? XP? 2k3? 2000?
>>
>>58706150
Bash is shit, just like every other scripting language, but at least it's not incompatible with itself.

>>58706159
You don't need to develop your own mini-language, just don't use a shit one either.

Also, I'm pretty sure if you need to execute certain commands, there are going to be certain time restrains to those commands.
Python is no good, no scripting language is going to cut it desu, compiled binary or bust.
>>
File: languages2.png (16KB, 522x384px) Image search: [Google]
languages2.png
16KB, 522x384px
>>
>>58706202
>haskell
>fast development
yeah maybe for the 100 people who know the language inside out
besides i thought the haskell people demonstrated an http server with better performance than c?
>>
>>58706202
>fast development
>anything ever

You can do anything simple in any language pretty fast.

You can't do anything complex in any language fast.
>>
>>58706226
Haskell generates 1gb garbage in a second so it should be unlikely unless the c implementation is is absolutely shit.
>>
>>58705995
Technically it's bytecode interpretted, much like Java is. Only you aren't forced to compilie it before runtime. So slow startup.
>>
Should I statically link DLLs into Windows binaries to avoid complaints from Windows babbies who don't know how to deal with missing DLLs?
>>
File: eg.png (16KB, 522x384px) Image search: [Google]
eg.png
16KB, 522x384px
>>58706202
>>
>>58706260
I can tell you don't know many programming languages well.
>>
>>58705557
>>58705628
Go has a niche: it's called the trash
>>
>>58706267
hmm, i remember seeing an article about this
that said, does anyone know why ghc 8 makes programmes allocate 1TB at entry?
>>58706272
even if you bytecompile, cpython still has a massive and expensive interpreter startup routine.
>>
>performance critical
>pure functional

Pick one
>>
>>58706343
How does it have the niche, if it's collected
>>
>>58704707
which is better
>>
>>58706226
Quite the opposite: people thought it had better performance, and then realized it was dropping something like 80% of all requests!
>>
>>58704892
common lisp?
>>
>>58706391
defo on the right
>>
>>58706391
left
>>
>>58706396
>it was dropping something like 80% of all requests
Ah, the 'fault tolerant' approach
>>
>>58705786
Nobody?
>>
>>58705982
Probably. I like it because:

It's fast.
It's clean and simple.
It's well designed for its purpose (embedding).
'Everything is a table' is a nice concept.

>>58706013
I didn't always like that, but it actually makes a lot more sense when you start considering negative indices, and it completely removes mental load when, for example, slicing.
Zero-based only really makes sense when dealing directly with memory (i.e., C*).
>>
>>58706280
This is what windows installers are for.
Chances are, even if they have the right DLLs they'll be too old for your requirements anyway.
>>
wtf, how much can it do?
>>
File: programming_language_chart.png (27KB, 522x384px) Image search: [Google]
programming_language_chart.png
27KB, 522x384px
>>58706300
>>58706202
>>
>>58706483
>java
>fast development
>>
>>58706483
>all of the above
>pick one
And C/C++ not under good performance, but Rust is?
It's so wrong I don't even find it funny :(
>>
File: IMG_20170129_181138947.jpg (783KB, 3000x2250px) Image search: [Google]
IMG_20170129_181138947.jpg
783KB, 3000x2250px
We do multiplexing now, but it still looks ugly as shit.
It is either flickering hardcore or looks like pic related. Not sure how to fix it yet, but we'll do it.
>>
>>58706483
>Java
>Ego boost
In what world?
>>
>>58706521
india obviously
>>
>>58706536
You could have said 'the third'.
>>
what's the language that is executed in 2d?
>>
>>58706482
FORMAT is pretty large. Probably on par with LOOP anyway in terms of simplicity.
>>
>>58706571
Any written language
>>
>>58706520
Neat. Reminds me of my days in electronics class.
>>
>>58706571
You might be thinking of befunge.
>>
>>58706571
Python
>>
>>58706592
I mean the one that the source code is a ascii map, and the interpreter executes according to that map
its an esoteric language
>>
>>58706614
Befunge or Piet.
>>
#include <stddef.h>
#include <string.h>

__attribute__((nonnull(1)))
static inline unsigned char _read_byte(const void * restrict src)
{
return *(unsigned char *)memcpy(&(unsigned char){0}, src, 1);
}

__attribute__((nonnull(1)))
static inline void _write_byte(void * dst, unsigned char src)
{
memcpy(dst, &src, 1);
}

__attribute__((nonnull(1, 3, 7)))
void blitb1(void * restrict dst_ptr, size_t dst_st,
const void * restrict src_ptr, size_t src_st,
size_t w, size_t h,
unsigned char (*op)(unsigned char, void *),
void * restrict arg)
{
for (size_t y = 0; y < h; ++y) {
for (size_t x = 0; x < w; ++x) {
unsigned char tmp;
tmp = _read_byte((unsigned char *)src_ptr + y * src_st + w);
tmp = op(tmp, arg);
_write_byte((unsigned char *)dst_ptr + y * dst_st + w, tmp);
}
}
}
__attribute__((nonnull(1, 3, 7)))
void blita1(void *dst_ptr, size_t dst_st,
const void *src_ptr, size_t src_st,
size_t w, size_t h,
unsigned char (*op)(unsigned char, void *),
void *arg)
{
for (size_t y = 0; y < h; ++y) {
for (size_t x = 0; x < w; ++x) {
unsigned char tmp;
tmp = _read_byte((unsigned char *)src_ptr + y * src_st + w);
tmp = op(tmp, arg);
_write_byte((unsigned char *)dst_ptr + y * dst_st + w, tmp);
}
}
}

i don't often agree with torvalds but holy hell having to do this garbage to work around the aliasing rules is straight up shit
>>
>>58706716
c was a mistake
>>
>>58706737
It was good at the time.

Unfortunately, that was half a century ago.
>>
>>58706267
GC performance goes down with the number of live objects, not garbage. Haskell's GC is designed specifically not to slow down with more garbage, because you do a lot of construction/deconstruction of data structures
>>
which IDE do I use if I'm a masochist?
>>
>>58706737
>>58706756
c is fine, the tool chain is the problem
the unix state of the art precompiler is STILL the m4 macro language
and that's some absolute 70s yank
>>
>>58706821
GNU Emacs
>>
>>58706821
emacs
>>
>>58706821
Vim
>>
>>58706558
Sorry I had to ruin your joke, autist
>>
>>58706716
What does this code do?
>>
>>58706835
You should be :)
>>
>>58706829
>>58706833
wrong
>>58706834
correct
>>
>>58706821
emacs
netbeans
code:blocks
>>
>>58706838
block image transfer routine (with arbitrary transform) for software mode computer graphics

_st stands for memory stride, eg. the number of bytes between between each display row
>>
File: BasicTV_tables.webm (2MB, 1920x1080px) Image search: [Google]
BasicTV_tables.webm
2MB, 1920x1080px
>>58704707
Here are some sexy tables from the BasicTV console

The hex strings are the hex ID representations. The first 8 bytes is a UUID, and the following 32 are the SHA256 hash of the owner's RSA public key (verification upon request).
>>
char x; //character
unsigned x; //byte sized bit array
signed x; //byte sized number

Why doesn't sepples understand this concept?
>>
>>58706897
c(++) originated as a fancy pdp-11 high level assembler

'char' is both the system word granular size and system text encoding type

it's nasty and a mistake
>>
>>58706850
CB is fine for c\++
>>
>>58706888
>>>/reddit/
>>
>>58704707

I just had an idea

a program that saves the last minute of audio that came out of your speakers and when your press a key it takes an audio screenshot and runs a script to load the last minute of audio into audacity
>>
>>58706973
its neat asshole
>>
>>58706985
u mean like shadowplay for sound xdd
>>
>>58706946
>c(++) originated as a fancy pdp-11 high level assembler
Nice joke.
>>
>>58706888
use 720 so you can have an actually watchable webm
>>
>>58706993
is ok bby <3
>>
>>58706999
i feel its true, and best explains lot of its design decisions
>>
File: 4357752539_d012ce380b.jpg (133KB, 500x375px) Image search: [Google]
4357752539_d012ce380b.jpg
133KB, 500x375px
Data mining reddit.com/r/the_donald and other alt-right sites comment sections to make a list in JSON format of Trump Supporters. Then, going to make a plugin for chrome and firefox which will flag names on the list with
pyccкий mиp
(Ruski Mir)
>>
>>58707013
i wasn't the guy you or any other shat on but i am very fucking well able to appreciate when people write dope shit, ESPECIALLY if they're noobs
>>
>>58707129
Boт жe пидopac.
Пoшeл нaхyй.
>>>/r/eddit
>>
@58707129
>in JSON format
gross
>>
>>58707173
Ukrainian looks so weird.
>>
>>58707002
I'd be afraid the text would be too blurry to read
>>58707168
I am that guy
>ESPECIALLY if they're noobs
watch it punk
>>
>>58707189
Пiшoв нaхyй
>>
>>58707202
ya sorry that was some kind of a spasm
>>
>>58707129
>dae ebil ruski? xd
>>
>>58707218
you think you are funny? fuck off
>>
>>58707232
jk you're fine m8
>>
>>58707255
Ha Peддитi poзкaзyвaтимeш.
>>>/r/eddit
>>
>>58707299
you are good people
>>
>>58707129
i am creating what is known as a "computer virus" to hunt you down. be prepared.
also see >>58707331
>>
Are design patterns typically discussed in the context of object-oriented programming?

I'm looking at a site dedicated to defining design patterns and they all seem to describe working with classes and the like.
>>
>>58707378
You can't hack me, I've got Norton anti-virus :^)
>>
>>58707374
no problemo my mateo
>>
>>58707411
oh, but i've got access to NSA/CIA/FBI backdoors in every single antivirus out there. you can't hide (゜.゜)
>>
File: 1485547923673.png (429KB, 451x619px) Image search: [Google]
1485547923673.png
429KB, 451x619px
Explain to me why anyone would do this:

Animal Cat = new Feline();


Instead of this:

Feline Cat = new Feline();



Whats the point if the Feline class can access everything in the Animal class.
Whereas if you define it as an Animal, you can't use everything in the Feline class.

What is being gained when you do it?
>>
>>58707482
>oop trash
stopped reading right there
thank you for posting anime though.
>>
I've become interested in brute force programming after Terry Davis mentioned that some common assembly routines have been generated by computers completely

What is this technique called? were to find information about what he was talking about?
>>
>>58707451
If you have an array of different kinds of animals, you can have felines and canines, like:

Animal[] zoo = new Animal[128];

zoo[0] = new Feline();
zoo[1] = new Canine();


and this way, your zoo can access methods which all animals have, but not the ones that the felines have. The feline's methods may be invoked by the Animal methods it overloads, however, so if you're making a game, and you want them to attack, you can say

zoo[0].attack()


where a cat's attack method may call its own method "scratch()" and a dog's attack method may call its own method "bite()"
>>
>>58707482
Makes it clearer that you only use the Animal parts of your Feline object.
>>
>>58707527
first help us hack this fag >>58707129
we will use assembly so that should give you some practice.
>>
>>58707533
Should be in reply to:
>>58707482
>>
>>58707482
>Whats the point if the Feline class can access everything in the Animal class.
thats literally the point of child classes
The top one is trash but not redundant
multiple inheratance is a mistake anyway
>>
>>58707556
>multiple inheratance is a mistake anyway
much like POO itself
>>
>>58707556
>multiple inheritance
that has nothing to do with multiple inheritance
Animal could be an interface or the single superclass
>>
>>58707527
Reverse engineering
>>
>>58707533
Thats actually a really good example and it helped me understand.
Thank You
>>
Inheritance is fine when you're using it to define an interface, and then an implementation class that implements it. Means you can pass in a dummy implementation to test the code.
>>
>>58707533
Why even give the methods different names than attack() if you are going to just call them in attack() anyway

OOP not even once, kek
>>
>>58707581
>that has nothing to do with multiple inheritance
we both know it was going to end up there
>>
>>58707630
I'm assuming it's Java code, so no, I don't think it will end up there at all.
>>
>>58707616
Record of functions is superior to inheritance for this purpose

Record of functions:
>Mix and match functions to serve your needs

OOP = POO:
>If you need some but not all of the functionality of another implementor of an interface / implementation class, either need to copy paste code or inherit and make garbage relationships
>>
>>58707621
It's a simple example; obviously for something so simple they'd just be attack. However, there may be certain methods and attributes specific to cats and dogs that would affect their attack. For modularity, it's good to have functions only take up a few lines at a time and only do one thing in essence.
>>
>>58707647
that could be sepples but you're probably right with all the pajeets here
>>
>>58707586

No it isn't
>>
>>58707482
That forces you to only use the Animal parts, which guarantees you can substitute it later with a different class implementing it and have it still work.

Well, that's assuming you don't use instanceof or downcasting, which defeats the purpose of subtyping in the first place.
>>
>>58707549

I'd like to hear how you plan on doing that

email me

[email protected]
>>
File: 1398732222473.jpg (62KB, 417x384px) Image search: [Google]
1398732222473.jpg
62KB, 417x384px
Anyone can save my life and try to run this shit and tell me how you fixed it

http://www.mediafire.com/file/3epxgee73qxv32b/Version+Finale.rar
It's Java EE (Spring Boot)
It tells me "org.w3c.dom.ElementTraversal"
>>
>>58707741
first i need to verify something.
you're not one of 'them', are you?
and no, i'm not talking about CIA niggers
>>
File: 1474258685924.webm (4KB, 217x240px) Image search: [Google]
1474258685924.webm
4KB, 217x240px
>he unironically uses break statements
>>
>>58707549
>>58707741
lol

remember when script kiddies were a thing? well they're back - in pog form
>>
>>58707771

I'm not anybody
>>
>>58707129
WALLS GOING UP IVAN
>>
>>58707787
>he unironically uses try/catch
>>
>>58707807
that's impossible, mate
i need to know that you're not with 'them'
>>
>>58707787
>4KB
Are you a wizard?
>>
File: 1465788977028.webm (61KB, 720x960px) Image search: [Google]
1465788977028.webm
61KB, 720x960px
>>58707812
>he unironically uses goto
>>
>>58707793
>assembly is a scripting language
not sure what you meant there
>>
File: rmsGodModeUnlocked.png (602KB, 799x472px) Image search: [Google]
rmsGodModeUnlocked.png
602KB, 799x472px
>>58704707

Thinking about algorithms.

So say I have two images and I want to be able to spot differences between them:

- any differences boolean - Image hash

- any differences, highlighting the differences - cycle through each and if that specific pixel differs then highlight it

- any differences but one of the images has had some filter applies - colour histogram

- any differences but one of the images could have had random things within it recoloured

So for this last one you could make both of the images black and white according to some threshold value - but what if you don't know what the background colour of the images will be?

Any ideas /g/? I have a few but they fall apart if multiple things in the image can be randomly recoloured.
>>
>>58707836
>he unironically uses languages
>>
>>58707844
Try converting it into Y'UV and using the Y component?
>>
>>58707822

HOLY SHIT HOW DID YOU GET MY PHONE NUMBER
>>
>>58707862
>he unironically uses punch cards
>>
File: 1484797935410.jpg (50KB, 640x480px) Image search: [Google]
1484797935410.jpg
50KB, 640x480px
>>58707888
>
>>
>>58707886
your on the fucken list, buddy.
>>
>>58707731
This sounds like the best explanation.

But is there any reason why you would want to switch out different classes.
Wouldn't break all of your code since there would be a ton of interactions?
>>
>>58705729
>import Data.IORef
Fag
>>
>>58707929
>But is there any reason why you would want to switch out different classes.
The simplest example is an array list vs. a linked list. They can both be used as lists, but you might want to switch them for performance reasons down the line.

>Wouldn't break all of your code since there would be a ton of interactions?
No, that's the point of subtype polymorphism - that you can substitute anything implementing an interface where anything of that interface is expected. There are often features in the language that break this property (instanceof, downcasting) and they should never be used.
>>
>>58707955
b-but it's not really mutable state if I wrap it up in some kind of black box!!
>>
>>58707836
Why is that a webm?
>>
>>58707871

I'll look into this, thanks
>>
Mutable state is great as long as you control it with an effect system, substructural types, session types, etc.
>>
>>58707994
Scared by a little global variable?
>>
>>58705786
print the returned value from read(), also use errno. I bet you are doing it wrong...
read the manpage, read(2)
>>
>>58707994
That's what these dunces never understand
>>
>>58707994
>trying to reason with FPurists
stop
>>
>>58708012
No, actually, because you can control globals just as well.

>>58708018
It's funny, because plenty of real FP research is about that stuff. These "FPurists" don't have a clue.
>>
>>58708031
pure FP is truly superior
>>
>>58708018
But it's so easy to reason when you don't have to worry about mutation :)
>>
>>58708054
If you're talking about "purity" in terms of functions actually being functions, then this stuff >>58707994 is all about purity.
>>
>>58708059
Yes but you have to worry about sharing.
>>
>>58708066
You can model stuff in terms of mutation without building it into the language
>>
>>58708069
>sharing
Ew groce.
>>
>>58708079
And you end up having to write tons of code to compose effectful operations together. I know exactly who you are and I still think you're a moron.
>>
>>58708079
Simon?
>>
>>58708094
>tons of code
You write >>= once
But really this is about you saying "I want someone else to do this!!!"
in which case, libraries
>>
>>58708129
Kangaroo man?
>>
Why many programming language VMs are stack-based?
>>
>>58708129
And what about monad transformers, stacks, what if you don't want your effects to be FIFO?
>>
>>58707960
I actually don't understand so I'm just going to give you my questions

If you have something like
 
Feline extends Animal


And the Animal class has a
 getName() 
method.
And somewhere in your code you have it printout the name using the method. If you 'switch out' the Animal class for a 'different' class, but don't include a new
 getName() 
method in the new Animal class, the code wouldn't compile because the method doesn't exist.

Furthermore, if you have

Animal implements Organism


And Organism has some integer that is essential to the function of the program, switching out the interface for a new one but not defining the same integer would break the code because that integer no longer exists.
>>
>>58708171
MTL and transformer stacks are perfectly fine
With dependent types (or even with a million extensions) you could do better. You could also write the effect system yourself.
>>
File: IMG_4626.jpg (102KB, 711x681px) Image search: [Google]
IMG_4626.jpg
102KB, 711x681px
Been working on a GBC emulator for a while. I've got the whole thing working, but I've been trying to work out the best way to schedule the emulator to keep it aligned with the audio thread (CoreAudio, so it's a pull-based API that's requesting sample buffers at regular intervals).

Currently have a separate emulator thread waiting on a condition variable that's signalled at the end of the audio buffer full callback, which means except for the first callback call the emulator always runs for just long enough to fill a full buffer of samples for CoreAudio.

It works nicely, but doesn't feel like a good way of solving the synchronisation problem.
>>
>>58708187
>If you 'switch out' the Animal class for a 'different' class,
He means switching out the Feline class for a different Animal subclass.
>>
>>58708210
cute maki
>>
>>58708210
ditch threads and write a simple dumb cooperative scheduler instead
>>
>>58708210
>multithreaded emulator
for purpose?
>>
>>58708015
>print the returned value from read(),
Interesting. Somewhere between 1mb and 2mb it stops working; for 1mb the return value of read is 1000000; for 2mb it's -1.
errno @ 2mb is 1 "Operation not permitted"
>>
File: cs-question.png (40KB, 735x366px) Image search: [Google]
cs-question.png
40KB, 735x366px
Answer this or you will forever be a webshit.
>>
>>58706301
I can tell you never had a job.
>>
>>58708274
sorry anon but im not doing your homework
>>
>>58708274
math is for nerds
>>
File: 1464707664781.jpg (15KB, 484x132px) Image search: [Google]
1464707664781.jpg
15KB, 484x132px
>>58708272
Pic related.
>>
>>58708259
I wasn't specifically setting out to write it that way, I just ended up with a second thread when I decided to write a simple AudioUnit for sound playback
>>
>>58708190
>With dependent types (or even with a million extensions) you could do better. You could also write the effect system yourself.
This is fine for proving metatheoretical properties about a system and/or elaborating a user-facing language to a core language. For actually making a programming language to write code in, it's pointless.

Should we just use the CoC as a programming language?
>>
>>58708274
answer what? please don't conflate facts with homerowrk
>>
i hate exception handling, is this normal
>>
File: i have no idea of fun filename.jpg (285KB, 1600x1045px) Image search: [Google]
i have no idea of fun filename.jpg
285KB, 1600x1045px
>Programming - the second literacy. The first gives literacy skills. The second - allows to realize their knowledge into action.
Do intelligent people learn programming?
>>
>>58708379
yes
>>
>>58708223
But what if one method in the subclass overrides a method in the super class in a different way than another sub class?

Feline extends Animal

getLove() {

return (time/affection)*2;

}


vs

Canine extends Animal

getLove() {

return (time/affection)(time/affection);

}
>>
>>58708379
i mean it is nicer than constant manual error checking

but yeah its normal to hate it, but its the best we got
>>
>>58708372
We could use Rust's CoC as a programming language.
>>
>>58708372
>For actually making a programming language to write code in, it's pointless.
No it isn't.
It could be in the standard library
>>
What would be the best alternative for Spring MVC? I heard here that Sprinh wasn't a good idea. Don't know if I was trolled or not.
I need something to developp in Java EE
>>
>>58708392
i'm a drunkard
>>
>>58708413
If it's not pointless, what do you gain? You lose a lot of things. Nice syntax, good error messages, the compiler using the information for optimization.
>>
>>58708407
>its the best we got

MONADS
O
N
A
D
S
>>
>>58708431
You don't lose any of those things.
And you gain a simpler language
>>
>>58708442
ALGEBRAIC
F
F
E
C
T
S
>>
>>58708401
Both return a float - what would it break?
>>
>>58708457
Monad transformers > algebraic effects
>>
>>58708457
What if you want a [IO] ([IO] Int)?
>>
>>58708455
>Nice syntax
You have to use do-notation and/or >>=, <$>, <*>, <|> everywhere.

>Good error messages
>Optimization
How can the compiler possibly get these from a library? For example, if the core language is intuitionistic, how can the compiler derive optimizations due to non-aliasing from a substructural type system library?

>>58708504
No.

>>58708518
What?
>>
>>58708442
you can't write functional systems code though

there's a reason why C and such still strive and exist
>>
>>58708523
Yes. Monad transformers are more powerful.
>>
>>58708523
>You have to use do-notation and/or >>=, <$>, <*>, <|> everywhere.
Wrong

>How can the compiler possibly get these from a library? For example, if the core language is intuitionistic, how can the compiler derive optimizations due to non-aliasing from a substructural type system library?
1) Standard library
2) A language that allows the user to expose optimisations
>>
>>58708550
But they don't commute.

>>58708574
>Wrong
Elaborate.
>1) Standard library
What the fuck is the difference, then?
>2) A language that allows the user to expose optimisations
Right, mind explaining a bit how that would work?
>>
>>58708585
>But they don't commute.
So?
>>
>>58708274
noone will ever need this in programming 2bh
>>
File: 1475392597571.jpg (16KB, 604x151px) Image search: [Google]
1475392597571.jpg
16KB, 604x151px
>>58708322
>>58708272
hmm
>>
>>58708585
>Elaborate.
A language that lets you create your own syntax, or stuff like ! syntax from Idris.

>>58708585
>>1) Standard library
>What the fuck is the difference, then?
It's not built into the language.

>>58708585
What about when you don't want them to commute?
And you can always build a commutative version, just have a typeclass saying some monad transformers allow you to go m (n a) -> n (m a)
>>
>>58708541
>there's a reason
Yes.
There's no functional language with manual memory manipulation.
>>
>>58708625
>It's not built into the language.
Why are you championing this as an inherently good thing?

>And you can always build a commutative version, just have a typeclass saying some monad transformers allow you to go m (n a) -> n (m a)
Then you have to swap them around manually.
>>
>>58708670
http://hackage.haskell.org/package/base-4.9.1.0/docs/Foreign-Marshal-Alloc.html#v:malloc
>>
>>58708699
...and many other properties of C which lead to the most compact machine code.
>>
>>58708743
>There's no functional language with manual memory manipulation.
>>
>>58708789
Well, I'll come back again when I have Haskell system code.
>>
>>58708686
>Then you have to swap them around manually.
Not really

>>58708686
>>It's not built into the language.
>Why are you championing this as an inherently good thing?
Because it is, it's a fact of PLT
>>
>value
>Value
which One?
>>
>>58708814
The problem is Haskell doesn't let you run exclusively manual memory

>>58708971
value
>>
>>58708963
>Because it is, it's a fact of PLT
Is that so.
>>
>>58708980
>value
whY?
>>
>>58708988
yup

>>58708991
Value is disgusting
>>
>>58708997
>Value is disgusting
>Subjective
>>
>>58708997
>>58709054
Not an argument.
>>
>>58709054
>>subjective
Fuck off
>>
>>58709058
Nigger
>>
>>58708971
I use kebab-case for type-kinded things and PascalCase for kind-kinded things.
>>
>>58709065
Not an argument.
>>
File: 1462595909873.gif (14KB, 416x416px) Image search: [Google]
1462595909873.gif
14KB, 416x416px
best language for multithreading your fizzbuzzes?
I vote for C++
>inb4 segfaults
>>
Can anyone explain effectful monads in fstar-lang.org to me? It seems like Greek to me.
>>
>>58709081
What about sort-kinded things?
>>
I need help with some compilation error in C

here is my functio:
int **createArray ( int rows, int cols )
{
int **array = malloc(rows * sizeof *array + (rows * (cols * sizeof **array)));

int *const data = array + rows;
int i;
for(i = 0; i < rows; i++) {
array[i] = data + i * cols;
}

return array;
}


I get this warning in the command line when I compile.
Warning initialization from incompatible pointer type
int * const data = array + rows;
^
Program works just fine with the function. I just want to get rid of the warning and still have it work. How do I do this? Is it because its **array and *data?
>>
New thread:

>>58709139
>>58709139
>>58709139
>>
>>58709136

literally Python
>>
>>58709136
>multithreading your fizzbuzzes?
now this is shitpoting
>>
>>58709152
>
createArray

for what reason
>>
>>58706391
That color scheme is cancer.
The words should stand out most, the parens should be light, not the reverse.
>>
>>58709152
int* and int** are not the same pointer type.
>>
>>58709210
>he hasn't done multithreaded fizzbuzz
now this is shitposting
>>
>>58705804
>>58705908
https://stackoverflow.com/questions/16332448
https://stackoverflow.com/questions/15167809

No idea if they have an actual name but I googled for "tag input".
Also, stop using windows forms...
>>
>>58708274
1st one is by induction, I guess
2nd one... prolly by induction, too
3rd one, no idea.

ask >>>/sci/
Thread posts: 322
Thread images: 38


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