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

File: 1407882994759.jpg (72KB, 400x579px) Image search: [Google]
1407882994759.jpg
72KB, 400x579px
Previous thread: >>56753671

What are you working on, /g/?
>>
Refactoring some Elm code. Statically typed functional languages make it so easy...
>>
>>56757740
And Java implements lambdas using interfaces and classes too.
(j) -> i == j

is syntactic sugar for
new IntPredicate() {
boolean test(int j) {
return i == j;
}
}
>>
When you compare two objects of custom classes (my question is for AS3 but I'm also curious about C# and Java) with an == operator, does it compare every element of that class?

Would it be faster to compare an element of the class (unique ID int) instead?
>>
>>56757835
OOP IN LOO
>>
>>56757835
>And Java implements lambdas using interfaces and classes too.
That's functional programming, not OOP.

Also, >>56757876
>>
>>56757835
what happens if you do
(j : FooClass) -> new BarClass()

in Java, what is that equivalent to?
>>
Im setting up mingw cmake and shit on wangblows so i can test on winshaft... I dont know what I'd do without cygwin and chocolatey
>>
>>56757894
>it's completely unnecessary to do it this way as opposed to function pointers, but the point is to illustrate capability
>>
So I figured out some of the framelimit stuff since last thread. I've got
while (programIsOn)
{
auto start_time = std::chrono::high_resolution_clock::now();
// dostuff
const auto MAX_FRAME_TIME = std::chrono::nanoseconds(16666667);
auto delta_time = std::chrono::high_resolution_clock::now() - start_time;
if (delta_time < MAX_FRAME_TIME)
std::this_thread::sleep_for(MAX_FRAME_TIME - delta_time);
}

But the 16666667 seems like a super stupid way to store 1/60th of a second in nanoseconds. Anyone know of a better way?
>>
>>56757933
no
>>
>>56757944
thx
>>
File: wew bane.gif (860KB, 245x209px) Image search: [Google]
wew bane.gif
860KB, 245x209px
>>56757822
>>56757922
>>56757933
>>56757944
>>
>>56757926
The point was never to illustrate capability. The point was to illustrate examples where a puristic OOP design doesn't cut it.

C++/Java lambdas/anonymous classes/functors and treating these as first class citizens and creating state capturing closures are arguably a concept derived from functional programming.
>>
>>56757977
>state capturing closures
*currying
>>
>>56757835
This isn't entirely true, see http://stackoverflow.com/a/33874965
>>
>>56757837
nevermind
>>
File: 529.png (2KB, 60x60px) Image search: [Google]
529.png
2KB, 60x60px
I'm currently taking a look at the akari-bbs source and came across some interesting syntax in the xss_sanitize function.
    static const char *escape[UCHAR_MAX] = {
['\n'] = "&#013;", /* change '\n' to '\r' */
['\"'] = "&quot;",
['\''] = "&apos;",
['<'] = "&lt;",
['>'] = "&gt;",
['&'] = "&amp;"
};

How exactly does this work, and is it standard syntax? Never seen something like that...
>>
>>56758314
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
>>
>>56758342
Now that's a nice feature. Thanks for providing the link.
>>
Haskell frontend for Processing.
>>
>>56757796
Learning C# by implementing a simple card game.

I've shuffled the deck just fine, now I'm trying to cut the deck.

I've used this:
private Card[] Cards;
public void cutCards()
{
Card[] tempDeck = new Card[52];
Random rnd = new Random();
int randomCut = rnd.Next(0, 51);
int x = 0;
for (int i = randomCut; i < 52; i++)
{
tempDeck[x] = Cards[i];
x++;
}
for (int i = 0; i < randomCut; i++)
{
tempDeck[x] = Cards[i];
x++;
}
Cards = tempDeck;
}


But does that final "Cards = tempDeck" cause a memory leak?
Should I free the original Cards array before I assign it?
>>
>>56758506
Since you're assigning Cards to a new thing I don't think you need to worry about nulling first. However I'm not an expert.
>>
>>56758506
Since the array previously pointed to by Cards has no more references pointing to it, I'm sure it will get garbage collected.
From what I've read leaking memory in a garbage collected environment is not entirely impossible, but a lot more complicated than passing things around the way you do.
>>
>>56758506
>"Cards = tempDeck"
is not valid syntax. You need a variable name.
>>
>>56757933
Also, for some reason I'm getting 61.333fps with this. No idea what that's about.
>>
>>56758506
>>56758548
Memory leaks can only occur when you've got a string of references somewhere where you don't expect it.
Say you've got an anonymous class: The anonymous class actually keeps the outer class from being collected, because it captures its scope. This isn't an issue, but you gotta keep in mind that as long as a small anonymous class is alive, a big outer class may be alive as well.
Trees for instance are a similar issue. Let's say you're leaking references to nodes and want to delete the tree. You null the root, thinking the GC will take care of it. However, any reference to a sub tree of the root will drag around the entire sub tree of that node reference as well, even though you didn't intend it.
There are no memory leaks in terms of forgetting to free something, but in terms of overlooking that you're still dragging around something.
>>
>And then there is Annabelle McAllister who is raising up the dead...
>>
>>56758558
Cards is a variable, not a type. See the top line.

>>56758548
I see. I'd prefer to manage it myself, mainly because I can't be positive that it has actually been cleaned up, but I guess just keep going until I realise there's an issue?

Or anyway I can be sure it does get freed?
>>
>>56758611
float inaccuracy.
>>
def y():
return niggerjews("y()")
>>
File: Untitled.png (63KB, 1912x956px) Image search: [Google]
Untitled.png
63KB, 1912x956px
>>56758670
;_; So jealous of programs that can run at a clean 60fps. Gonna go to bed and try to figure it out tomorrow.
>>
>>56758750
Are you writing this in a language with GC?
>>
>>56758765
Nah, that's C++.
>>
>>56758657
I see. variables should be camelCase.

There's no memory leak because the previous values that Card had gets garbage collected.
>>
>>56758722
Sorry to bother Sir but this throws the error:
NameError: name 'niggerjews' is not defined

???
>>
>>56758776
So it should be "cards" for the variable name?
>>
File: spic disgusted.png (135KB, 288x415px) Image search: [Google]
spic disgusted.png
135KB, 288x415px
>>56758776
>variables should be camelCase.
vomited
kebab-case if possible, else snake_case
>>
>>56758776
>variables should be camelCase.
I prefer CameltoeCase, you know, first and last word capitalised while there's a gash in the middle.
>>
File: snek.jpg (39KB, 595x595px) Image search: [Google]
snek.jpg
39KB, 595x595px
>>56758789
hisss hissss

its snek
>>
>>56758789
fuck off, camelCase is standard for C#. Always use what is standard for the language.
>>
>>56758810
Nope, PascalCase is. camelCase is J*va OOPOO tier.
>>
>>56758820
I've literally never seen PascalCase sued for variable names in a C# code base.
>>
File: 1440969357277.jpg (53KB, 444x337px) Image search: [Google]
1440969357277.jpg
53KB, 444x337px
Anybody else noticed, that this thread was a snoozefest until some /pol/cuck posted here and some other people reacted? About half posts in this thread aren't even about programming anymore.
>>
>>56758996
>/dpt/
>programming
:carat)
>>
Is this a valid use of gotos in C?
int
file_read(File *file, uint16_t *data, size_t pos, size_t size)
{
FILE *fp;
uint8_t *temp;
size_t read;

if (file == NULL || data == NULL)
return -1;

fp = fopen(file->name, "r");
if (fp == NULL)
return -1;

temp = malloc(size);
if (temp == NULL)
goto err_fclose;

fseek(fp, pos, SEEK_SET);
read = fread(temp, 1, size, fp);
if (read == 0)
{
goto err_free;
}

fclose(fp);

for (size_t i=0; i<read; ++i)
{
/* set buffer byte and set visibility bit */
data[i] = (1<<8) | temp[i];
}

free(temp);

return 0;

err_free:
free(temp);

err_fclose:
fclose(fp);

return -1;
}

(this in my attempt to save this thread, please help)
>>
>>56759278
>goto
oh boy, here we go
>>
>>56759278
Yes, if it was a function that wasn't main. There is no actual reason to close file descriptors and free memory when exiting (other than to get valgrind to stop complaining), because the OS does this when your program terminates.
>>
>>56759314
He'll get banned soon if the mods are awake.
>>
>>56759295
>Just use Ctrl+F and copy the post number into it, sans the @.
That's too much effort, especially because I have to use my mouse to select the number and copy it instead of just hovering over the >> link.

>>56759299
No, I'm not reporting you for disagreeing. I'm reporting you for being offtopic and hijacking a programming thread.

>>>/pol/
>>>/b/
>>
Someone's feeling (You) deprived. They love the red ! icon on their tab.

:^)
>>
>>56759326
>They love the red ! icon on their tab.
What? Which browser or user script does this?
>>
>>56759337
Stock 4chan does this. Changes the favicon.
>>
>>56759346
>Stock 4chan does this. Changes the favicon.
It doesn't in Chrome (on Linux or on Mac)
>>
File: shillbot-.jpg (3MB, 4998x4666px) Image search: [Google]
shillbot-.jpg
3MB, 4998x4666px
>>56759360
You know there's actual bots that copy posts with get the most replies, right?

>>56759372
It happens for me on palemoon/chromium on windows.
>>
File: hillary ctr shilling.jpg (1MB, 1024x1536px) Image search: [Google]
hillary ctr shilling.jpg
1MB, 1024x1536px
>>56759392
Hillary's spent over $1m on creating a Hillary Internet Defense Force
>>
>>56759392
>he doesn't know what ctr is
Basically, it's short for Correct the Record, a super PAC that specializes in shilling for Democratic Presidential Candidate Hillary Clinton.
>>
File: dpt 13.png (244KB, 1920x1080px) Image search: [Google]
dpt 13.png
244KB, 1920x1080px
>tfw your internet bf is asleep but you woke up early
ughhhhh might as well do some programming :/
>>
>>56759341
>Jewish people
See >>56759080

Your beloved black lives matter movement hates jews and doesn't think the holocaust happened.
>>
>>56759405
>>56759400
Thanks

>>56759396
>You know there's actual bots that copy posts with get the most replies, right?
Well, I'd think these bots would use posts from /b/ then, and not the daily programming thread where 40 people tops actually lurk.
>>
>>56759408
I'm afraid you came to the wrong thread then.
>>
>>56759408
odds use vc++
evens use g++
>>
>>56759450
shit...

what now......
>>
>>56759396
>You know there's actual bots that copy posts with get the most replies, right?
But anon, this is how we managed to make Tay racist. If we stop doing this, AI bots will not see the light behind the jewish deceit.
>>
>>56759450
>>56759458
use TurboC++
>>
Can somebody explain what akari-bbs is? I don't browse /dpt/ very often
>>
>>56759535
It's pure cancer.
>>
>>56759535
see http://akaribbs.mooo.com
So far it's a 4chan-like yet text-only board named (and styled) after an anime character.
The source is available on github and I find it (the source) quite interesting, see >>56758314
>>
>>56759535
Someone created a chan-like website in C and named it akaribbs, the end.
>>
File: 1470103952194.jpg (19KB, 300x360px) Image search: [Google]
1470103952194.jpg
19KB, 300x360px
>>56759565
>>56759567
Thanks.
>>
>>56759603
see >>>/akari/11189
>>
Since every language is shit according to /dpt/, what would dptlang look like?
>>
>>56759749
Haskell
>>
>>56758342
>Designated
THE LOO
>>
Why do comonads enjoy so little usage?
>>
generals were a mistake
-moot 2015
>>
File: wew2.gif (114KB, 405x411px) Image search: [Google]
wew2.gif
114KB, 405x411px
Well, I guess the dust has settled. Who /graphics/ here?
>>
>>56758810
>>56758820

camelCase for local variables, member variables, and parmeters. PascalCase everything else.

https://blogs.msdn.microsoft.com/brada/2005/01/26/internal-coding-guidelines/
>>
>>56760013

The whole "PascalCase for properties" thing was a misfire, I think.
>>
>>56760021
>misfire
C# in a nutshell

and the sex lives of those who use it
>>
i do camelCase for functions and underscores for variables LOL
>>
>>56760035
>LOL
XD
>>
>>56760013
that's what I said.

>>56760021
I like it

>>56760033
C# is great

>and the sex lives of those who use it
I can only speak for myself, but yeah, that's accurate : (
>>
I really feel like donating to the valgrind devs.
Saved my life yet again.

I just wish there was an option to whitelist your project instead of having to blacklist every library you use.
>>
File: 1471900898275.jpg (45KB, 577x622px) Image search: [Google]
1471900898275.jpg
45KB, 577x622px
>imperative programming
why?
>>
>>56760033

C# is mostly good, and there's only a few mistakes.

>>56760058
>I like it

Well, you're wrong. I bet you like static using statements.
>>
>>56760155
>there's only a few mistakes.
What ones?

>Well, you're wrong.
Always helps me tell if something is a field or a property pretty easily.

>I bet you like static using statements.
Of course, what's wrong with static?
>>
File: 1458169242478.jpg (14KB, 251x242px) Image search: [Google]
1458169242478.jpg
14KB, 251x242px
Why do web devs have to ruin everything?
>>
Hi /dpt/
I don't post much but I hope you're all having a very nice day
>>
#56760188
>frogposter

Do not reply to this faggot.
>>
>>56760085
Because some of us actually work with real hardware with real world constraints.
>>
>code review and product testing happens, on something that isn't even close to being done
>boss finds a few bugs I haven't gotten to fixing yet
>he ends by saying he loved what I had done, and that he was impressed how solid it was overall
>tfw you don't know if he really thought that or if he's just being nice
>>
http://www.w3schools.com/js/js_object_prototypes.asp

I am thoroughly confused.
>>
my dad just called me fat :/
>>
>>56760349
Time to lose weight then fatty >>/fit/
>>
>there are people who still use OOP in current year

OOPfags are killing programming.
>>
>>56760363
>>>/fit/ even
>>
Since we're already funposting.

What's the appeal of formatting urls like this: domain.tld/api/method/parameter/order/date instead of the old way: domain.tld/api?method=foo&order=date ?
I get that URI queries are fucking ugly, but you're not seeing or handcrafting them anyway.
On both the client and server side exist mature and well tested code bases to handle the queries, while this path bullshit has to be matched with flimsy regex:

Server - nginx:
location /api {
set_unescape_uri $arg_foo;
echo $arg_foo;
}


Client - python requests:
requests.get("doman.tld/api", params={"foo": "bar", "id": 4})


I'm sure apache and JS work in similar ways. Is it just the usual webdev faggotry "Change for the sake of change" or am I missing something?
>>
>>56760377
>>56760363
ugh i dont need fit to tell me how to lost some fat... its obvious
>>
I want to make a simple platform game. Should I use a game engine? Which language are good for this?
>>
>>56760391
You're going to have to lose it some day man. And when you do you'll regret not doing it earlier. I believe in you anon :3.
>>
>>56760376
>there are fat NEETs on this board who write their fizzbuzz-tier programs in C
kys
>>
>>56760418
odds do some pushups
evens shitpost for another hour
0 go take a shower
>>
>>56758750
1. Are you sure that they all run "at a clean 60fps"?
2. Advanced engines definitely have much smarter ways of dealing with fps, you use the most primitive way to count it.
>>
>>56760384
Read about REST.
>>
File: b72.jpg (54KB, 607x428px) Image search: [Google]
b72.jpg
54KB, 607x428px
>>56760391
>>56760418
GTFO
>>
File: .jpg (13KB, 354x286px) Image search: [Google]
.jpg
13KB, 354x286px
>trying to start bot for website
>open up firefox to get POST data like always
>submit, page changes, post data lost
What do? How do I retain that data?
>>
>>56759942
>baby did his first sdl script
gratz
>>
just did 20 pushups now its time to program xD
>>
>>56760384
usually you have middleware that handles the matching. most of that is pretty well tested at this point i think
i don't think rest is as extreme as you say. the path shouldn't need to handle every single parameter. there's some hierarchical (this seems like a good thing) way to specify a resource and then you interact with that
>>
Okay /dpt/, let's make an AI programming game/contest!

What are the rules?
>>
swift is the best language
>>
>>56760615
whites only
>>
>>56760644
>Implying niggers know programming
>>
>>56760445
Dumb objectfag
>>
>>56760697
You know programming don't you?
>>
File: file.png (97KB, 284x339px) Image search: [Google]
file.png
97KB, 284x339px
Fuck. I keep seeing really cheap computer parts and I really want to build a gaming desktop. But I really want to be mature and not play video games. I've never had a gaming desktop though.http://i.imgur.com/h2kfGPp.jpg?1
>>
File: 1465745950049.png (602KB, 963x720px) Image search: [Google]
1465745950049.png
602KB, 963x720px
>>56760743
Where's the programming in this post?
>>
What maximum texture size should I target for my game engine?
This big textures will be used only for the background tiles of the map.
Should I go for 2048px or 4096px is better?
>>
>>56760399
>Unity if you want to waste your life
>HTML/CSS/Javascript if you are a faggot
>C if you are fat
>C++ if you are an asshole

Do it with Rust + Vulkan
>>
>>56760762
8192
>>
>>56760762
You should allow whatever texture size is supported by the hardware.
>>
>>56760760
Computer parts require programming
>>
>>56760730
of curs i kno progaming fagushit i code html snek
>>
>>56760787
>buy shit off ebay
>who //prog// here
>>
File: current year.jpg (21KB, 240x255px) Image search: [Google]
current year.jpg
21KB, 240x255px
>>56760376
>>
>>56760807
> le current year maymay XDDDD
>>/pol/
>>
My serious thought about the problem with OOP:
it's too far from real mathematics and too far from the machine binary as well. You are getting the worst of every worlds.
>>
>>56760807
into the >>>/pol/ you go my friend
>>
>>56760837
lel, k tard.
>>
>>56760556

It's not even SDL. :^)
>>
>>56760826
>>56760844
Thanks for correcting the record.

2 guns have been confiscated and deposited into a smelter.
>>
>>56760837
It's too far from real OOP too
>>
File: 1.png (121KB, 1855x1056px) Image search: [Google]
1.png
121KB, 1855x1056px
>>56760773
>>56760777
I'll try to implement it, also what is a good performance for the rendering?
I have an old pc and right now I can show 2000 sprites before the fps goes below 60.
>>
pair programming
>>
In Android Studio, when I click 'run,' a new window pops up.

I want it to close the previous window, as it creates the new one.

What do?
>>
Hey guys,

Did you know that Java and C# are basically the same language?
>>
>>56760981
Giving up is always an option
>>
>>56760997
C# evolved from Java. All Java's shity mistakes are fixed.
>>
>>56760997
in the same way that blacks and asians are the same species
>>
>>56761000
I don't know why I post on this board

If I had friends I wouldn't need this place
>>
>>56761017
Wrong. C# inherited almost all of Java's shortcomings. A completely unimaginative language.
>>
>>56759408
fug
>>
>>56761042
It fixed generics, has good lamda support, unsigned integers, easy native interop, less verbose. Hard to fault desu.

It's comfy as fuck.

F# is even better.
>>
File: gki.webm (3MB, 1280x720px) Image search: [Google]
gki.webm
3MB, 1280x720px
>>56761017
>C# evolved from Java.
"""
Osborn:
I've been looking at press stories about C# [pronounced "See sharp"] and notice that many of them seem to lead with the observation -- or perhaps the theory -- that C# is either a clone of or a Microsoft replacement for Java. If you could write the headlines, what would you like people to say about the language?

Hejlsberg:
First of all, C# is not a Java clone. In the design of C#, we looked at a lot of languages. We looked at C++, we looked at Java, at Modula 2, C, and we looked at Smalltalk. There are just so many languages that have the same core ideas that we're interested in, such as deep object-orientation, object-simplification, and so on.

One of the key differences between C# and these other languages, particularly Java, is that we tried to stay much closer to C++ in our design. C# borrows most of its operators, keywords, and statements directly from C++. We have also kept a number of language features that Java dropped. Why are there no enums in Java, for example? I mean, what's the rationale for cutting those? Enums are clearly a meaningful concept in C++. We've preserved enums in C# and made them type-safe as well. In C#, enums are not just integers. They're actually strongly typed value types that derive from System.Enum in the .NET base-class library. An enum of type "foo" is not interchangeable with an enum of type "bar" without a cast. I think that's an important difference. We've also preserved operator overloading and type conversions. Our whole structure for name spaces is much closer to C++.

[...]
"""

>>56760997
Not really.

>>56760945
pair programming what ?

>>56760908
Hard to tell without your computer config, the used programming language and api.

>>56760349
daisuki~
>>
>>56761074
F# is unimaginative too.

Neither C# nor F# supports anything beyond the most simple abstractions, just like Java.

Java generics are less broken than C# generics.
>>
>>56758314
The sanitizer is missing
['`'] = "&#x60;"
>>
>>56761093
Just another unimaginative OOP language.
>>
>>56761115
It's not just your average joe's snake oil, it's extremely snaky oil
>>
what do you guys think of go
>>
>>56761100
>Neither C# nor F# supports anything beyond the most simple abstractions
Thats true. Though more advanced langugaes have their own problems. C# is a great get-shit-done langugae as it is.

>Java generics are less broken than C# generics.
Go on..
>>
>>56761150
>more advanced langugaes have their own problems
such as
>>
>>56761143
Terrible language.

>>56761150
>C# is a great get-shit-done langugae as it is.
I find it hard to 'get shit done' when I'm constantly having to repeat myself in code.

>Go on..
Parametricity (although Java goes on to shit itself by allowing reflection)
>>
>>56761093
>Hard to tell without your computer config, the used programming language and api.

HD6750, E5700, C++ and SDL2.
No OpenGL, just normal SDL2 calls.
>>
>>56761167
Many programmers don't understand them therefore they're bad
>>
what is the /dpt/-approved language/framework for website backends
you guys hate js, ruby, python, php, and java
>>
>>56761190

C
>>
>>56761190
Haskell
>>
>>56761190
>webdev
Fuck you
>>
>>56761190
JS is a front-end language and a terrible one at that. Don't ever use it on the backend. I don't care if that means you have to learn another language (oh how terrible you poor thing).
>>
>>56761190
There is no good language for web development
>>
Where can I find some programs to edi in visual studio 2015 and see how they work. I'm mostly interested in seeing how people use the desgin tab for things and how things there work.
>>
>>56761231
webasm
>>
>>56761172
are you rendering the same texture x 2000 ?
>>
>>56761236
Nobody actually uses VS, why do you think they give it away for free?
>>
>>56761167
Poorer ecosystem. Less target platforms, smaller community etc.
>>
>>56761246
Yes, each x is a character that moves on the screen.
>>
>>56761238
>javascript
>>
>>56761169
>Parametricity
How do you mean?
>>
>>56761253
What should I use then?
>>
>>56761231
TypeScript front end, F# backend.
>>
>>56761267
If you want better performance, use OpenGL and https://www.opengl.org/wiki/Primitive#Point_primitives
>>
>>56761263
Those are all the same thing, and all caused by this line of thinking
>>
Participating in competitive programming in a bit as a noob. Wish me luck that I don't completely bomb the whole thing and at least get like 2/8 correct.
>>
>>56761290
What line of thinking? I don't care what causes that problem, when i pick a language i have to deal with that shit.

I'm not going to use ocaml for mobile development when F# was much much much better support for such shit. I can't ignore that fact despite ocaml being technically better as a language.
>>
>>56761282
vim/emacs
>>
>>56761263
Haskell has loads of great libraries on hackage
>>
>>56761284
>>56761308
F# sucks, though.
>>
>>56761285
I'll do it later if I'll need to render more than 2000 things at the same time, the last time I tried OpenGl I gave up.
>>
>>56761323
I know. Other langugaes have many many more.

>>56761328
no
>>
>>56761211
i have some projects that need websites
you are using a website

>>56761218
people seem to be successfully using node for asynchronous/distributed stuff. i know erlang has great support for this too but it doesn't get nearly as much attention, it seems to me
>>
>>56761336
yes
>>
>>56761336
>Other langugaes have many many more.
[citation need-

Oh, you mean all those retarded OOP libraries like .NET that do nothing but wrap and wrap and wrap shit.
You don't mean actual features.

The goal of OOP is to procrastinate actual programming as long as possible.
>>
File: 4chanThreadViewer.jpg (218KB, 1680x1050px) Image search: [Google]
4chanThreadViewer.jpg
218KB, 1680x1050px
pls r8 https://github.com/Dwillnio/4chanThreadViewer/tree/master/pkg4chan/explorer
>inb4 why didnt you use a json library
>>
>>56761349
no. F# is good
>>
>>56761093
the only excuse java has for the java virtual machine always running is portability.
C# isn't very portable, unless you're counting mono, but .NET is always there, abstracting for no reason at all.

All the disadvantages of java with none of the advantages. Welcome to microsoft's backyard.
>>
>>56761339
You'll get much faster development if you use Haskell or Scala or Clojure or Scheme or CL

People who use node only do so because they're incapable of learning a second language
>>
>>56761356
are you that comma split/parser anon from yesterday?
>>
>>56761339
nodejs' way of doing concurrency is terrible
>>
>>56761356
Lame
>>
>>56761350
>Oh, you mean all those retarded OOP libraries like .NET that do nothing but wrap and wrap and wrap shit.
how is that not a feature?

>The goal of OOP is to procrastinate actual programming as long as possible.
Exactly. That why it's good for getting shit done.
>>
>>56761379
yeah
>>
>>56761359
nope, I'm afraid it isn't

it only seems like it's good if you've never seen any other functional language
>>
>>56761356
>he's still parsing context free languages like regular languages
kys
>>
>>56761093
Though they are kind of wack in java, doesn't it have those strongly typed enums?
>>
>>56761403
No, it is. I've seen other langugaes and I still know it's good :^).
>>
>>56761391
>how is that not a feature
FileReader(Reader(Stream(Console(
>>
I'd like to get into pen testing. What are the 5 most important languages to learn?
>>
>>56761412
F# is the same as what happens whenever any dysfunctional language decides to take a feature from a functional language, they always take the most rudimentary, limited, first-order approximation of it and it ends up being almost useless.
>>
How do you guys find things to work on? I've done most of the programming challenges and want to make something useful now, but there is just nothing I can think of.
>>
>>56761404
>learned few words that sound buzzy
Okay fag, tell me difference between context free grammar and regular one, also elaborate your main point
>>
>>56761434
Depends - what sort of pens? Biros? Fountain pens?
>>
>>56761415
What's that got to do with a strong library ecosystem?
>>
>>56761434
English, C, intel x86-64 ASM, lambda calculus, coq
>>
>>56761331
>the last time I tried OpenGl I gave up
Why?
>>
>>56761441
Useful? Hmm you know how there is always mess in file system. Make sorting program. So everything is in its place. Videos in proper folder, books in their own etc...
>>
>>56761437
But F# isn't any of those things. That's why it's great.
>>
>>56761441
make a game
>>
>>56761456
That's what you mean by a "strong library ecosystem"

Take .NET's libraries and divide that by 5 because of OOP nonsense
Then divide it by 20 because of the verbosity of coding in the language

Now you have the equivalent haskell
>>
>>56761434
Php, java, hindu, windows batch scripting, light grasp on english
>>
>>56761478
it has no support for higher-kinded types

so it can only do extraordinarily basic abstractions

so it's shit
>>
>>56761496
Yeah, it would be nice to have those I agree.

But it's still great.

I can use langugaes with those features, but then i lose the wide quality platform support and strong library ecosystem.
>>
>>56761504
any jvm language would fit that, on the other hand you get jvm... so who knows
>>
>>56761486
okay, but why would i divide by 5 or by 20? What has verbosity got to do with the usefulness of the libraries?
>>
>>56761441
Find something that you like to do often. Whether it be a certain game, an activity, or just really anything. Make something small that relates to your pick, and slowly expand on it.

What also works is just following up on random ideas in your head and seeing where they end up. I had a random thought after uni about a program that would randomly throw you around the system, and I ended up making it after I got home.
>>
>>56761504
>wide quality platform support
>strong library ecosystem
You're literally just repeating the sell talk now
Got any real reasons?
>>
>>56761504
>But it's still great.
It's not, though, and you've just admitted it. It's the least imaginative 'functional' language out there. It would be better if it didn't exist, because right now it serves to pull people toward it instead of to better languages, and people come to think that functional programming is as shit as F# makes it.
>>
>>56761446
Not him, but an instance of a cfg that isn't regular is a language like c
>>
>>56761469
Too many things to learn.
With SDL2 I can pretty much write my own stuff, with OpenGL I have to write what OpenGl wants.
>>
>>56761520
There's no JVM language as good as F#. And JVM is pretty shit for mobile development, which I'm fond of.
>>
>>56761522
I just told you
Divide by 5 because of the OOP bullshit, like the example I gave
Divide by 20 because of how poor the abstraction is

>>56761539
Scala's on JVM, but with type annotations as verbose as Java
>>
>>56761531
Those are good things for productivity.

>>56761532
>It's not, though, and you've just admitted it.
No, i explained why it's great. The ecosystem is part of that.
>>
>>56761535
>Too many things to learn.
You don't have to use most of the functionality OpenGL provides.
>With SDL2 I can pretty much write my own stuff, with OpenGL I have to write what OpenGl wants.
What do you mean?
>>
>>56761539
Scala, despite its many, many problems, is far better than F#.
>>
File: good.jpg (78KB, 1280x720px) Image search: [Google]
good.jpg
78KB, 1280x720px
>>56761534
maki for you

>>56761539
Huh isnt whole android based on java? I dont know how more mobile you can go
>>
>>56761556
>Those are good things for productivity.
"strong library ecosystem" and "wide platform support" are just abstract base classes with no inheritors
>>
>>56761556
>can only express the most basic abstractions in it
>it's great lol
>>
>>56761556
Not having to repeat yourself in code is also a good thing for productivity, and it's something that no .NET language currently has.
>>
>>56761557
I mean that it's a lot simpler to use.
>>
>>56761552
I don't see how that "OOP Bullshit" is bad. Simple .NET wrappers for other libraries are useful as fuck.

>Scala
Scala is monstrously fucked up. It's worse than Java by a long shot.
https://www.youtube.com/watch?v=uiJycy6dFSQ

otherwise I'd probably use it.

>>56761573
Java is pretty shit for iOS development.

>>56761575
Which are useful as fuck.

>>56761594
I agree. But the ecosystem is far more important than having extra DRY code. I guess that's my opinion, but it seems to be true too.
>>
>>56761573
He's a bit of a dunce mate
>>
>>56761606
>I don't see how that "OOP Bullshit" is bad
>>
>>56760463
What's the more advanced ways? Update every 16ms OR if something has actually changed, then update?
>>
>>56761606
Haskell has an absolutely fantastic ecosystem. It might not have as many libraries, but the ones it does have are immensely powerful and couldn't even exist for most other languages. Would you rather have a single silver spoon or a choice of a dozen plastic spoons?

Oh, and although Paul has ranted about Scala's problems several times, he has also said he thinks it's probably the best language around right now.
>>
>>56761446
a context-free grammar is more complex than a regular one.
a context-free grammar may contain recursive structures.
parsing a strict, flat subset of a context-free grammar like a regular grammar is possible, but not recommended and easy to get wrong (e.g. if a structure always has exactly 0 <= x <= 3 levels of recursion you can write a regular grammar for it, you cannot do this for x >= 0).
your parser however doesn't even handle the level of nesting provided by the 4chan api, even though there's a constant amount of layers.
>>
is setting a 256bit random char token in a cookie/database secure enough to give access to a page?
>>
>>56761606
>worse than Java
False. You can use Scala as 'Java without semicolons', so it cannot be worse than Java.

If your complaint is that you cannot always read others' Scala code, then maybe the fault is with you and you should go read a book.
>>
>>56761596
OpenGL is much more powerful.
>>
>>56761671
im not that anon, but okay maybe you didnt just remember buzz words.

>>56761686
Whenever i have to use jvm for whatever reason i just use scala at least its succint...
>>
>>56760399
If it's 2D, GameMaker or C++ with OpenGL or SFML (there's a few other proper engines, but GM is friendly for beginners, if a bit retarded, but if you get the hang of it and realize it's shortcomings then C++ with OpenGL or SFML is the way to go, there's a book specifically for SFML around.
Don't touch Unity and I think Unreal is overkill for a beginner platformer.
>>
>>56760545
Run the bot as an external process.
>>56761143
Niche language. Very good for servers and surrounding infrastructure, like CLI tools and peripheral services.
>>56761190
Go.
>>
>>56761726
why not sdl alone? It should do the trick for normal 2D games, also in sdl2 textures are hardware accelerated so it wont be as slow as sdl1
>>
>>56761744
Go is absolute garbage. Don't recommend it for anything ever again. Educate yourself.
>>
>>56761356
>using a non-monospaced font for programming
>java
>all those o(n) and higher methods called back to back while parsing
>>
File: 1461358684390.png (55KB, 217x190px) Image search: [Google]
1461358684390.png
55KB, 217x190px
>>56761726
Thanks
>>
>>56761757
Constructive criticism, friend. Have a (You)!
>>
go was literally designed for people who aren't capable of using other programming languages.
>>
>>56761757
What do you recommend to use for fucking backend? Choice is pretty much java, python, ruby and horse shit php
>>
File: not an argument cool edition.jpg (39KB, 468x553px) Image search: [Google]
not an argument cool edition.jpg
39KB, 468x553px
>>56761772
>>
>>56761772
Go gets products and coproducts the wrong way around at the very heart of its API design.

>>56761787
Scala
>>
>>56761762
>using a non-monospaced font for programming
>java
k
>all those o(n) and higher methods called back to back while parsing
How should I do that better? Are you critisising the methods themselves, i.e. they are inefficient?
>>
File: Backtopol.png (317KB, 546x697px) Image search: [Google]
Backtopol.png
317KB, 546x697px
>>56761792
> LE EPICCC ARGUMENT MAN MAYMAYYY xDDDDDDD
welp, time for you to fuck off 2 >>/pol/
>>
>>56760399
>>56761770
Anon (>>56761747) suggested SDL, which I have 0 idea about, I just know that OpenGL can be a pain, and that setting up SFML was incredibly easy, just need to link every library it has when compiling the game. Look at SDL too if you go the C++ route.
>>
>>56761787
Please educate yourself. There are plenty of options for backend. I used to work as a backend web developer in C++.
>>
>>56761833
wtf I love ctr now
>>
>>56761843
>OpenGL can be a pain
OpenGL is fun.
>>
>want to write a code
>decide to use go
>need to use a fibonacci heap
>need to use it for more than one type in different places
>oh shit, I cannot do that
>welp better copy and paste the implementation for each type
>oh fug, there is a bug in it
>I hope I didn't miss an implementation when copying and pasting the fix
>>
>>56761806
>wrong way
Still not very descriptive.
>>
Anybody tried pic related desk mounts for monitors or know of any really good ones?
>>
>>56761747
>>56761843
I will consider it, thank you
>>
>>56761844
Are there any good frameworks for cgi with c++? That would be awesome
>>
>>56761861
It is perfectly descriptive. Go's APIs use products where they should use coproducts.
>>
>>56761873
Not programming related, fuck off retard.
>>
>>56761880
Well, it depends on what your definition of good is. There are some FastCGI frameworks, but after having worked with mod_wsgi, I would say that FastCGI is pain.

We used IIS in my old job, there's a FastCGI framework for C++ and IIS called Blackbox at least, but it's 20 years old and not many use it.
>>
>>56761859
Use interfaces and define methods on the passed type.
>>56761882
Unless you can expand on why you think you opinion is right or point me to an article explaining this, your arguments do not look much more than "X does Y wrong, because I said so".
>>
>>56761190
ASP.NET.
>>
>>56761190
/dpt/ hates webdev in general.
>>
>>56761938
I humbly submit that you ought to learn more about programming before replying to me.
>>
>>56761974
Still no explanation on why X is wrong.
>>
>>56761993
Why would you use a product when what you have is a coproduct? It's madness.
>>
>>56762004
The difference between madness and innovation is social acceptance.
>>
Any hardware programmers here?
>>
>>56762024
But this isn't that. This is trying to put a square peg in a round hole. It's insisting that 1 + 1 = 1 x 1.
>>
How long does it take to become good at programming?

I can do basic C and with a small amount of googling can probably achieve most things with it.

But soon as I hit OO, I get so confused!
>>
>>56762035
And you still have not explained how X is wrong.
>>
>>56762132
I have, you just don't realize it.
>>
>>56762120
Probably about 10 years
>>
>2016
>nobody has programmed a yuki
>>
>>56761885
>Device that allows monitors to be rotated to portrait mode for better programming setup isn't programming related
Lel
>>
>>56762242
By that logic, a discussion about office chairs and desks also belongs in this thread.
>>
>>56762293
dont forget floorings, walls, roof, clouds, sun, food, air, water, pizza, anime
>>
>>56762320
>anime makes you a better programmer
I like you.
>>
i need to take control of my life
>>
Why do people keep creating build systems that are inferior to autotools/make?

STOP IT YOU SHITS
THE OLD STUFF WORKS
YOUR NEW STUFF DOESN'T
>>
>>56762421
scons > autotools > autoconf > cmake > make
>>
>>56762377
I agree, and to tell me how to into hardware programming
>>
>>56762333
I thought it was just crossdressing?
>>
>>56762433
first step is for me to lose the 20 lbs i gained the last 3 months
>>
>>56762444
There's no reason to not do both. Making cupcakes for your sweet boyfriend while crossdressing and cosplaying as his waifu increases your programming skills by a factor of at least 23%. It's scientifically proven.
>>
I never watch any programming related vids, it's an unfortunate case.

CAN you recommend me any videos I can watch on my programming downtime (while eating dinner, usually).
>>
>>56762664
I usually just watch (more listen actually) to speeches given about some topic.
>>
>>56762664
watch the video that changed programming forever
https://www.youtube.com/watch?v=Gzj723LkRJY
>>
can someone give me an easy project to practice my C?
>>
>>56762717
make an AI so that you don't feel as miserable and lonely you dumb fucking shit fuck you
>>
>>56762717
4chan image scraper
>>
Object Orientated help please.

I'm trying to implement a poker game in C#.

I have a deck class that creates a deck, shuffles and cuts the deck and can also deal out cards.

I'd like to then deal a card to a player that I create. And then be able to print the cards that have been dealt to that player.

So far I've managed to deal the hand to the player by passing the Card object to the player.

However, when I want to print the card that the player has, I try and print by calling the Deck class and passing the cards.

But the compilation fails as the player class can't see the Deck class.

Is that correct?
>>
>>56762717
Make the linux du command with the user being able to use the h and s flags.
>>
>>56762730
:(
>>56762750
is it cheating to use wget?
>>
>>56762786
Probably.
C sockets aren't too bad, but if you want to make it easy, you could use libcurl
>>
>>56761285
sdl2 already uses opengl, tard
>>
>>56762686
Yeah, it would be mostly listening if it was during dinner.


Got any vid recommendations?
>>
new thread when ? :3
>>
>>56762765
>Card class
>Deck class
>Player class
>OOP
>>
File: euler.png (45KB, 360x140px) Image search: [Google]
euler.png
45KB, 360x140px
>>56762717
In case you're interested in mathematics, I'd recommend Project Euler.
>>
>>56757913
That doesn't work, you cant specify the types of lambdas specifically.
>>
>>56762004
Madness? This is Sparta!
>>
>>56762928
how do you pronounce euler?

yew-ler?
>>
>>56762765
>player class can't see the Deck class
Not sure if I understood that right but couldnt you just pass a reference to the deck class in the players constructor
>>
>>56762970
oiler
>>
>>56762970
oy-ler
>>
>>56762977
Player Class:
using System;
namespace Poker
{
public class Player
{
private String name;
private Card[] hand;

public Player(string playerName)
{
name = playerName;
hand = new Card[2];
}

public string getName()
{
return name;
}

public void addCardToHand(Card newCard)
{
if(hand[0] == null)
{
hand[0] = newCard;
}
else
{
hand[1] = newCard;
}
}

public Card[] printHand()
{
return hand;
}

}
}


Snipper of Deck class to print hand:
       public void printHand(Card[] card)
{
for (int i = 0; i < 2; i++)
{
Console.Write("Suit is: {0,-10}", Enum.GetName(typeof(theSuit), card[i].get_suit() - 1));
Console.Write("Value is: " + Enum.GetName(typeof(theFace), card[i].get_faceValue() - 1));
Console.WriteLine("");
}
}


And main game class:
using System;

namespace Poker
{
class MainClass
{

public static void printNamedHand(Player name)
{
Console.WriteLine(name.getName() + "'s hand is:");
Deck.printHand(name.printHand());
}

public static void Main (string[] args)
{
Deck Deck = new Deck();
Deck.shuffle();
Deck.printCards();
Deck.cutCards();
Console.WriteLine("Cards now being cut\n\n");
Deck.printCards();
Player player1 = new Player("Just_Steve");
player1.addCardToHand(Deck.dealCard());
player1.addCardToHand(Deck.dealCard());
printNamedHand(player1);

}
}
}


On the Deck.printhand call, I'm getting "Object reference is required to access non-static member" error.
>>
>>56762970
jewler
>>
File: triggeringintensifies.gif (133KB, 311x366px) Image search: [Google]
triggeringintensifies.gif
133KB, 311x366px
>>56762970
>yew-ler
>>
>>56763030
Because printHand() is not static.
You can only call methods in the form of Class.Method() if they're static, if they're not static you need to instantiate the class and use that object to call the method.
>>
>>56762970
oiler
>>
>>56763030
the public void printHand(Card[] card) method doesnt access any of Deck's fields/variables right?
So you should make it static in this case
I dont really get how youre calling the method atm anyway the printHand() method doesnt really make sense to me
>>
>>56763086
>>56763086
No, I think I know what I've done.

Deck.printHand() is going to the class, not the object Deck. I've basically done a terrible naming scheme that the class and object have the same name,

That's right isn't it?
>>
>>56763123
Wait you can Objects the same as their class in C#
LMAO
yeah I think thats it try and fix it
>>
>>56763158
>>56763123
Oh in case you overlook it, you need to pass your deck object to printNamedHand(Player name) as an argument and call printHand() with that otherwise it still wont work
>>
>>56763158
Apparently so. I only realised after I noticed the colouring that the keyword was was blue (for a class) instead of white for the object.

By passing in the deck object to the printHand method, it now works right.

Thanks guys. I'm sure I could implement this in a much better way, still learning.
>>
>>56759372
can confirm it does in firefox and chrome on both, but only if you have the page autorefresh
>>
>>56759408
from random import choice
print(choice(range(00,99)))

Wrote this to pick randomly.
>>
>>56763289
>00
>>
>>56763253
>but only if you have the page autorefresh
Ah, that would explain it I guess.
>>
>>56763311
It's the first number in the list, dipshit.
>>
maed a nu bret: >>56763328
>>
>>56763326
1. You can use 0.
2. range defaults to starting with 0.
3. Also you have a bug in that 99 will never be returned.
4. You're a shit.
>>
>>56763326
what if you get 101..........
>>
to the anon who suggested project euler
i am stuck on number 3

(The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?)

how can i solve this with a 32bit cpu (600851475143 > uint32 max)
>>
>>56763584
Use 64bit integer?
>>
>>56760349
Fatass
>>
File: tfw_quicksort.jpg (203KB, 2854x1611px) Image search: [Google]
tfw_quicksort.jpg
203KB, 2854x1611px
>>56757796
Programming quick sort in mips
>>
>>56763584
Upgrade your computer
Thread posts: 333
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.