[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 21
File: 1456269195737.jpg (80 KB, 549x1190) Image search: [Google]
1456269195737.jpg
80 KB, 549x1190
Previous thread: >>53510337

What are you working on, /g/?
>>
>>53517629
Prepare for the virgin anime images.
>>
File: 1439648511159.jpg (116 KB, 469x469) Image search: [Google]
1439648511159.jpg
116 KB, 469x469
>Actually waited for the bump limit before making a new thread
>No trapshit
I love you OP
>>
Give me C projects.
>>
>>53517645
https://github.com/torvalds/linux
>>
>>53517648
Give me "doable in a week or something" C projects.
>>
>>53517663
Sane taskbar for Linux using xcb, supporting skinning and Lua to script widgets.
>>
>>53517663
flappy bird using raw opengl
>>
>>53517663
Implement RFC1350 (octet mode only)
Make a shell/command interpreter and add some fancy features
Make a JSON (or some other markup format) parser and implementation
>>
>>53517671
Is the red book still a good way to learn opengl?
>>
>>53517635
I have only posted this two times, I'm very very grateful for the help and also it's not my homeowrk, it's for a very, very important project.
>>
>>53517677
seems like it only has fixed function pipeline stuff so no, it's deprecated
>>
>>53517704
So what would be?
>>
>>53517704
or actually it has later versions, i was looking at this old one:
http://www.glprogramming.com/red/

this one is more recent and should be fine

http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321773039
>>
Is there anything Python doesn't have a library for?
>>
I would like to know if I can ask a ver general and retard thing here, but I'm really really new to this and I would like to get some info.
>>
>>53517744
Look in the last thread, that's what I did and as a result I was ridiculed by like 6 different people and only one helped me. But you can try.
>>
>>53517744
you can ask pretty much whatever, even non-programming things, but the responses may contain harsh language
>>
Does c++ have a built-in method to find the highest value of an element in a vector/array? Do I have to make it myself?

Working with opencv BTW.
>>
>>53517779
That's why I asked before. Usually in generals is common to find nice people if you're polite. But you never know.

>>53517802
That's always a posibility. I'm asking then.

I wanted a little project to get into code. Nothing fancy, and soomething I think I will find useful. I want to "create" a kind of assistent.

Nothing sci-fi. Will be a program/script that when you gives it a parameter, it will reply you something about it. Examples:

You say to him "weather" it tells you the weather for today.

"News" will give to you a few news from the feed you told him, etc.

I was thinking in trying it 1st in a simple terminal, from linux, and I was thinking the tool I need is wget. Am I right in this? Should I try to understand right wget to get that kind of reply from a script?
>>
>>53517744
Sure

don't listen to this cunt >>53517779
he's posted his homework here a bunch of times and acted like he was entitled to us doing it for him and started throwing around insults because we were too slow
>>
>>53517826
Learn Python and use requests library to pull data from APIs, what you're trying to do is what most IRC bots do so you want to do something similar, minus the IRC integration, but rather simple user input and terminal output.
>>
>>53517843
I'm really new, so forgive me if I say retard things.

Is it better to take that request from an API than from a webpage? Or is just easier?
>>
>>53517856
It's easier if there's an API because you're simply querying the API with some parameter and get the data you're interested in. When you request a website you have to parse the HTML to extract the information you want instead.
>>
>>53517826
I'm sure there are plenty of Weather APIs out there, and I'm certain that the New York Times has an API.

You can do it using wget if you hate your life. A saner approach would be to use a scripting language Python.
>>
>>53517872
>>53517933
I will check scripting on python then, very thanks.
>>
How much time should i spend on choosing uni? Have 1 month to decide and dont know if i really can choose right or how hard i should try to find the right one.
Wheb trying to become a programmer is these thimgs important to think of?
>>
>>53518160
Pick the school with the best reputation. The quality of its education is of secondary importance because any good programmer will mostly be self-taught anyway.
>>
File: taylor-series.png (176 KB, 1920x1080) Image search: [Google]
taylor-series.png
176 KB, 1920x1080
Cleaning up some old code, I plan on adding the taylor series for the other trig functions
>>
>>53518160
More CS, less coding.
>>
>>53518265
>coding
>>
>>53518207
this
>>
>>53518265
What is CS...?
>>
>>53518282
Yes, less coding.
>>
>>53518304
>coding
>>
>>53518302
compooter science
>>
>>53518309
Yes, coding.
>>
Is there a way to make Python's asyncio execute a function every 5 minutes?
>>
>>53518528
It can easily be done in Nodejs but not in Python.
>>
>>53518536
How would you do that in Node.js then?
>>
>>53518528
Nevermind, figured it out.

def test(loop):
print('something')
loop.call_later(loop.time() + 300, test)

loop = asyncio.get_event_loop()
loop.call_later(loop.time() + 300, test, loop)
loop.run_forever()
>>
>>53518556
var minutes = 5, the_interval = minutes * 60 * 1000;
setInterval(function() {
console.log("I am doing my 5 minutes check");
// do your stuff here
}, the_interval);
>>
>>53518590
Just as I thought, you're retarded.
>>
>>53518579
You can't do that in python.
>>
>>53518615
Naw, this is working fine:
import asyncio

def dump(loop):
print('Dumping...')
loop.call_later(5.0, dump, loop)
#loop.stop()

def main():
loop = asyncio.get_event_loop()
loop.call_soon(dump, loop)
loop.run_forever()
loop.close()

if __name__ == '__main__':
main()


C:\Users\Anon\Desktop\test>python run.py
Dumping...
Dumping...
Dumping...
Dumping...
Dumping...
>>
>>53518615
You can do anything in Python.
>>
https://twitter.com/headinthebox/status/705963164815327232
>>
>>53518943
>le generics meme
Define generics. By itself it means nothing.
>>
>>53518953
Erik Meijer was in Microsoft's language R&D department. He is partly responsible for LINQ. He probably knows what he's talking about. You can disagree of course. I do, they are useful, but fuck do they add a lot of compiler complexity.
>>
>>53518943
What's wrong with this guy? He's been losing all my respect for him recently
>>
What is the best front end resource to make really good modern looking sites all of my sites don't look visually that great??
>>
>>53519297
>>>/g/wdg

also bootstrap
>>
what is good programming language to learn first for linuxfag?
>>
>>53519270
Sounds like he, unlike a lot of other FPers, realized that type safety has trade offs as well and came to the conclusion that optimal type safety may not be the solution.
>>
>>53519336
bash
>>
>>53519336
>>
Fuck java. I will become C++ developer.
>>
>>53519336
Bash is a great time investment for a Linux fag. I suggest linuxcommand (then a dotorg) for learning the basics.

Other than that, pretty much any language that's not a .NET language is good.
>>
>>53519647
>Other than that, pretty much any language that's not a .NET language is good.

There's nothing wrong with Mono.
>>
>>53517823
std::max_element
also, it's not part of the language per se - it's part of the library attached to it
even so, why can't you do it yourself? It's like 3 lines
>>
>>53519737
>Bulgarian man hunting refugees with PTS, MT-LB, and a shotgun

Amazing.
>>
I have an amazing idea for you guys to program we can split the profit 50% 50% I am one of the best idea guys around
>>
Anyone here know a lot about multithreading with C++?

I have as question.
>>
>>53519843
I'll pay you $5 to hear your terrible idea so I can laugh at you. Just post your paypal details.
>>
File: Untitled.jpg (145 KB, 1119x885) Image search: [Google]
Untitled.jpg
145 KB, 1119x885
Anyone know how to do these kinds of control system simulations in Matlab? Is this guy using a particular well-known package?
>>
>>53519871
It's just simulink.
>>
/g/ I'm new to programming, please tell my if my idea is fucking retarded.

I started out with Python, doing LPTHW, it's been fun, quick and all that. However, I started with some now C, as it seems like a great foundation. Here is where it gets weird, I know people say C is much more difficult then Python, but I seem to learn a lot faster trough C then Python, like being able to reason out what's going on is easier. Is it possible that the layers of abstraction in Python, (compared to C), is actually hurting the speed and efficiency of which I pick up concepts?
>>
>>53519863
A virtual reality video game for women where women get to go around a store and try on dresses and different outfits and it is linked to a live feed on video streaming service so they can have their real life guy friends compliment them and it will have a ranking system and they will compete with their female friends for who looks the prettiest
>>
>>53519911
Fuck my spelling, you guys get the essence.
>>
>>53519881
Oh thanks.
>>
>>53519918
It's so terrible that it may work.
>>
>>53519948
It would work women would love the overwhelming attention and being showered with compliments we would also add a token gift function where thirsty guys could donate money to the women for competitions and take that as in an game purchase also with ads from real clothing companies to be in the game to make even more profits! *rubs hands*
>>
>>53519911
This isn't an unusual reaction actually. I know plenty of people that have an easier time understanding C compared to Python.
>>
>>53519737
>not part of the language per se
the standard library IS part of the language
>>
>>53519983
Why would anyone want to watch the live feed? The women wouldn't be getting showered with attention, they will be in a room trying on clothes.

You've essentially said "Make a VR version of those shitty dress up flash games."
>>
>>53520083
Because men love to watch women do anything and would pay for women to just do anything it's simple
>>
How to do C# collaborative editting?
>>
>>53519918
>A virtual reality
stopped reading there
>>
>>53520185
source control
>>
>>53520226
I mean real time.
>>
>>53520230
What is the point of that exactly?
>>
>>53519851
bump
>>
Reminder that pass by reference is a meme.
>>
>>53520237
I'm sitting a few meters away from the person I'm programming with and I'm literally too fat to walk over to him.
>>
>>53520256
tmux session
>>
>>53520256
Do pair programming in only one machine.
>>
>>53520185
Just use git.

git pull remote origin


Done.
>>
>
>>
>>53520248
Define "pass-by-reference".
>>
>>53520248
t. Javafag
>>
>>53520537
front end.

Also, just finished this today. Feels good. https://www.codeeval.com/open_challenges/14
>>
[A Google+ linked 4chan gold account is required to read this post.]
>>
>>53520644
Fuckin' kek.
Why'd he even bother doing it then?
>>
File: raytraced.png (170 KB, 1000x1000) Image search: [Google]
raytraced.png
170 KB, 1000x1000
Here's some further progress on my RAYTRACER, /g/
>>
>>53520567
Meme.
>>
>>53520706
physical based lighting when?

:^)
>>
>>53520612
Java is pass-by-reference tho.
>>
I killed a CIA nigger by running him over on 9/9/99. I was being followed by agents and freaked out. It's okay to run-over space aliens.
>>
>>53517629
Anyone have tips for converting an internship at Facebook into a fulltime job? Im going to be a frontend intern and I like to just stay with my team after the summer.
>>
>>53520744
You're looking at it.
>>
>>53520537
frontend
>>
>>53520706
make it more interesting, it's hard to tell that it's raytraced at all.

make blue ball emit light and enclode it in a something, to show the effect.
>>
>>53520745

No it's not.
>>
>>53520706
Why can't I see the blue ball in the reflection of either of the others?
>>
>>53520745
Good joke
>>
>>53520745
Vagina vag;

is not a Vagina.

It's a pointer to a Vagina.
>>
>>53519911
That's exactly my opinion of languages

When it comes to the likes of Java, I found it less simple than C++ because there is so much abstraction. People think it's odd how I prefer C++ to Java and think it's easier to work with, but the more control you have, the less tied down to a paradigm you are, the easier it is to work with a language. In the same sense, I found C and Haskell to be the most fun languages and dead simple, C itself only has like 50 or so keywords I believe. Python is simple too, but for different reasons
>>
>>53520869
>is not a Vagina.
how did this shit pass QA?
>>
>>53520832
No joke.
>>53520869
No, Java has no pointers, only references; educate yourself.
>>
>>53520992
>Java has no pointers, only references
How exactly do you think that reference is stored in memory?
>>
>>53520992
>Java has no pointers, only references
hurrrrr
>>
>>53520992
Please state the difference you see between a pointer and a reference in a lang-agnostic context. If not, you're nitpicking useless smallshit and the joke is on you.
>>
>>53520992
>Java has no pointers, only references
So when do you say you were baiting all along and we've been epic trolled?
>>
>>53521020
>stored in memory
Implementation detail.
>>53521030
Are you saying pass-by-reference and pass-by-pointer are the same thing?
>>
File: 1456338740277.jpg (266 KB, 837x580) Image search: [Google]
1456338740277.jpg
266 KB, 837x580
>>53521020
Java does generational GC moving around shit, so it is very probable that there is some layer of indirection before you actualky get to the pointer like "object n* 372642 in the large objects' table" or whateva
>>
>>53521078
>Are you saying pass-by-reference and pass-by-pointer are the same thing?
In Java, everything is technically 'pass-by-pointer' in language agnostic verbiage, but Java calls pointers 'references'.
>>
>>53521078
Define the goddamn terms, fuck! I'm the one who wrote >>53520567, so yeah, if we dont it's gonna end into >>53507941 bis.
>>
>>53520813
I haven't added shadows or reflections yet, to add reflections the rays will have to recurse
>>
File: image005.jpg (10 KB, 378x214) Image search: [Google]
image005.jpg
10 KB, 378x214
Newfag with propably stupid question reporting in:
The standard Python editor IDLE does not support autocomplete, auto add closing bracket or even line numbers.
Notepad++ can do all of this.
How can I write a Python script in Notepad++ and execute it from there ?(Pyshell should open and run the script)
(random IDLE pic off the interwebs)
>>
>>53521078
>javafags don't even know basic shit like how pointers, values, references are dealt with
>>
>>53521124
Why not use PyCharm?

It's the Visual Studio of Python.
>>
True or false:
Any anti-reverse engineering software can also be used to obfuscate viruses to make them undetectable to AV software, and should therefore be made illegal.
>>
>>53521124
Save it as a .py file. Open terminal. Type
python path-to-file.py
>>
I want maki to cuckold me!
>>
>>53521149
She's clearly not a javafag, or she would have a basic understanding of how it works.
>>
>>53521152
>should therefore be made illegal.
>illegal

No.
>>
>>53521152
Absolutely false.

Not enforceable, much like trying to ban encryption.
>>
>>53521164
>She
LONDON
O
N
D
O
N
>>
>>53521098
>pointers and references are the same thing
>>
My wife's son is trying to get into COBOL

what are the best resources for someone young?
>>
>>53521113
>I don't know what references are
You don't belong in this discussion.
>>
>>53521193
Baseball and friends.
>>
>>53521193
Proper nutrition and short-term goals.
>>
>>53521192
>if I remove the pass-by- part, surely no one will notice I'm changing the argument
This javafag should kill herself imo
>>
>>53521208
What are they then? This should be a piss-easy question for you to answer since you're so cocky about it.
>>
How does /g/ deal with rejection? I applied for an internship, and did the interview but I'm pretty sure I'm not going to get it. I think being rejected would hit me pretty hard. Any advice?
>>
>>53521247
Drink a lot and put on some sad albums
>>
>>53521243
Please don't ask for homework help on /g/.
>>
File: 1454855224644.png (141 KB, 579x437) Image search: [Google]
1454855224644.png
141 KB, 579x437
>>53521247
>tfw applied to a job with no knowledge of 90% of their technologies, no degree, and I'm pretty sure I have autism, and I STILL got the job
Reminder that portfolios are everything
>>
>>53521229
>I don't have any coherent argument
kid...
>>
File: 1456054718953.png (511 KB, 560x601) Image search: [Google]
1456054718953.png
511 KB, 560x601
>>53521264
LAAAAAAWL! SUCH MEMEING! MY SIDES! THEY ARE IN ORBIT!
>>
>>53521278
>she's still arguing about pointers v references, instead of the original argument which was pass-by-pointers v pass-by-references
lass...
>>
>>53521247
How long ago did you interview?

I got called up 4 weeks after an interview of mine because the company was busy.

Didn't take the job because they couldn't offer two months of paid vacation.
>>
>>53521299
*pass-by-value vs pass-by-reference. That's right tho, I'm sure that "pointer" and "reference" are synonymous in this discussion, but some anons don't want to admit it, so we're forced to eliminate that first.
>>
>>53521292
>just spoon feed me simple word definitions
c'mon lad...
>>
>>53521343
>pass-by-value vs pass-by-reference
First it's mentioned ITT. Just admit you were an idiot who had no idea how references or pointers were stored in memory when being passed, or just kill yourself
>>
>>53521367
Just answer. What is even pass-by-pointers ffs? And are java object-valued variables objects or references?
>>
>>53521381
>how references or pointers were stored in memory
>references and pointers are the same thing
Please don't spread misinformation.
>>
>>53521078
In sepples there's a difference between pointer and reference, but Java's references are your good ol' double pointers.
>>
>>53521396
>object-valued
only on /g/ :^)
>>
>>53521381
Perhaps ITT explicitely, but there is such a thing as context, you closed-mind moron.
>>
>>53521408
>double pointers
bwahahahahaha
>>
>>53521400
They aren't the same thing, but Java awkwardly refers to pointers as references.
>>
>>53521400
>references and pointers are the same thing
Nice random implication, now try argue about how pointers/references are stored in memory when being passed, rather than trying to start completely different arguments, and maybe people will take you seriously

>>53521420
Indeed there is such a thing as context, so follow the context this argument is based on
>>
been trying to work on an atom package that's not going to work (:
>>
>>53521433
Aye, especially evident with string literals.
>>
>>53521439
>java references aren't real references
>muh language has the real references tho
Fuck off.
>>
Best way to learn c#?
>>
>>53521442
You're the dipshit who introduced this dumb "pass-by-pointer" expression in >>53521078. Before that, we were talking about pass-by-reference as opposed to pass-by-value (3 threads ago or so). Reference vs pointer in Java and C++ is indeed a corollary but irrelevant issue.
>>
I have a vector of structs in c++
how do i find all the duplicates in certain field?
>>
>>53521518
>You're the dipshit who introduced this dumb "pass-by-pointer" expression
>implying
I'm clearly arguing against him
>>
References are just "more secure" pointers, in the way that they can't be null. Guess what's one of the most frequent errors in Java :^)
>>
>>53521474
Java references aren't real references.

Making it green doesn't make it false.
>>
>>53521488
Murach's C# is pretty good. Plenty of PDFs out there.
>>
File: 1458104179403.jpg (309 KB, 680x1671) Image search: [Google]
1458104179403.jpg
309 KB, 680x1671
>>53521529
Maybe. In that case there is a dipshit, but it's not you. Don't give in to his simpleness though.
>>
>>53521553
Ill take a look ,thanks
>>
best references for django learning?
>>
>>53521539
>Java references aren't real references
Were you in the Java Language design committee or are you just making shit up?
>>
>>53521661
RAII pointers.
>>
>>53521661
the django official tutorial is good
>>
>>53521539
Java references are the only true references, anon.
>>
>>53521672
ur a cheeky one mate I'll give you that
>>
since /wdg/ is dead:

does anyone here have a recommendation for a CMS a la Wordpress?
I'm planning to move my personal website from one I built from scratch to a proper CMS system that I can just throw up and drop some style themes and plugins into and go
Was just gonna go with wordpress, but I then I thought there might be something more lightweight (running on a micro EC2 instance) or trimmed down that would be better
>>
>>53521700
There's a reason /wdg/ is dead.

GTFO.
>>
File: 1453666488559.jpg (58 KB, 479x400) Image search: [Google]
1453666488559.jpg
58 KB, 479x400
>>53521715
thanks for the input m8
>>
#include <stdio.h>

int main () {

int n, ncount;

for(n=1, ncount=1; ncount<10; ++ncount){
n=n*(ncount+1);
printf("%7i %i\n", n, ncount+1); //<=====8
}

printf("Total: %i", n);
return 0;
}


I'm writing a piece of code in C that prints a table of the first 10 factorials. The program works but I get the feeling I am cheating slightly by putting 'ncount +1' in the printf to signify the n!th value (next to the dick shaped arrow in the code).

Is there a more efficient way of doing this?
>>
>>53521750
>ncount<10
It only prints it nine times right? As for the +1, no. It's either that or a separate variable. Really there's nothing wrong with deriving the [2;12) sequence from the [0;10) one, though you might be able to for() iterate the first one, right?
>>
>>53521750
#include <stdio.h>

int main () {

int n, ncount;

for(n=1, ncount=1; ncount<10;){
n=n*(++ncount);
printf("%7i %i\n", n, ncount); //<=====8
}

printf("Total: %i", n);
return 0;
}


like this?
>>
>>53521442
>how pointers/references are stored in memory
>implementation details
gtfo
>>
>>53521866
>muh implementation details
javafag pls
>>
>>53521866
What is passed if you use a primitive like int or char?
>>
>>53521831
Literally perfect, I think I see where I went wrong too. Thank you

>>53521825
>Really there's nothing wrong with deriving the [2;12) sequence from the [0;10) one
Be gentle anon, I only started learning to program this week, I don't know what you mean by this!
>>
>>53521926
>I'm from reddit
>>
>>53521949
>admitting it
>>
>>53521942
Depends on many factors.
>>
>>53521945
That's not programming terms, it's colloquial usage of math terms.
>>
>>53521958
This forum is for 18+.
>>
>>53521992
And yet you're still here
>>
>>53522011
Well, I'm an adult. Do you need me to give you a definition for that word too?
>>
>>53522032
>Well, I'm an adult.
nice meme
>>
>>53522056
xD
>>
>>53521983
I didn't study maths to a particularly high level senpai :( I will do my best to understand if you explain what it means, though.
>>
File: 560662119.jpg (6 KB, 107x125) Image search: [Google]
560662119.jpg
6 KB, 107x125
I have a vector of structs in c++
the fields are
string name
string sexuality

it has hundreds of items
and now i want to show all of the names by sexuality be it Attack heli, dragon,furry,hetero,homo

how do i do it?
>>
File: triggered.gif (1 MB, 371x209) Image search: [Google]
triggered.gif
1 MB, 371x209
>>53522087
fug wrong pic
>>
File: lol.jpg (67 KB, 400x445) Image search: [Google]
lol.jpg
67 KB, 400x445
Are there any obvious problems with doing a fully concurrent ForEach loop?

For example, in C#, I could say
Parallel.ForEach(ListOfButts, butt => 
{
WriteLine(butt.Name);
});


What happens if there are like 300,000 butts?
>>
>>53522285
Nothing, it executed N items at a time, where N is the number of you PC's cores.
>>
>>53522285
Be wary of false sharing, it can make a naively executed "embarassingly parallel" task run slower than just doing it sequentially.
>>
>>53522393
>cores
AMD MUSTARD RACE!
>>
>>53522080
OK, let's go.

first thing: friendly reminder that your program is printing 9 factorial variables, not 10 as stated.

As for sequences. A sequence is some numbers in a particular order, for example "0, then 1, then 2". You can iterate that sequence, that is repeat the body of a loop for each of its elements pretty easily in C, e.g.
for(i = 0; i <= 2; i++)
, which does the aforementioned "0, then 1, then 2". The point of that is to think of it as an abstract concept, that you can implement without even having to think about it by """using the for loop idiom""" (notice the threefold quotation marks, it sounds overly Pajeet, but it says what it says).

The notation I used and a lot of litterature use, well, there it is:
It describes a continuous increasing sequence (the next one is the last one plus 1) using two numbers and three special symbols. We have an opening brace, either square or round; then the low boundary, which is a number; then a semicolon to separate; then the high boundary; then a closing brace, either square or round, independently from the shape of the first one. The shape of the brace tell you whether to include the nearby boundary in the sequence or not. You do if it is square, you don't if it is round (that's 100% arbitrary). So when you have, for illustration:
[1;3) -> start counting from 1, stop before 3, i. e. {1, 2}, in C:
for(int i = 1; i < 3; i++)

(n;m] -> start counting from n+1, stop at m, i. e. {n+1, ..., m}, in C:
for(int i = n+1; i <= m; i++)

[4;6] -> you know the drill ;-)

Disclaimer:
#include <stdio.h>

int main () {
int fac = 1; // keep the for loop """idiomatic""" so we don't have to stop to think about what it does. Also "fac" tells a lot more.
int i; // the shorter, the better.
for(i = 1; i <= 10; i++){
fac *= i;
printf("%7i %7i\n", i, fac);
}
return 0;
}
>>
File: 1367439980239.jpg (477 KB, 1305x1265) Image search: [Google]
1367439980239.jpg
477 KB, 1305x1265
>>53522087
>>53522109
FUCK i am not baiting i just made that example to explain what i want to make

SEND HELP
>>
Why functional programming?
What makes it better?
Is it just a meme?
>>
>>53522448
>WriteLine
cache coherency issues are the least of his worries
>>
>>53522480
Why object-oriented?
Why procedural?
Why logical?
Why aspect-oriented?
>>
>>53522480
Why not?

>>53522490
I understand that was for the sake of example.
>>
>>53522496
>meme-oriented
>>
File: oij.png (474 KB, 1500x2050) Image search: [Google]
oij.png
474 KB, 1500x2050
Playing with the Cortana API.

>that comfy feel when I can shout "Hey Cortana, play the next episode." from my bed and it automatically plays the next episode of the last anime I watched.
>>
>>53522490
?
>>
>>53522549
Pretty fucking pathetic.
>>
>>53522468
Also, by "derive [2;12) from [0;10)", I meant using the expression i+2, knowing that, if i runs through the latter, this expression will run through the former, so you can use both things in two different places, and therefore run through the two sequences in parallel. I realised this is not needed in this problem tho.

Note that you can derive pretty much anything from a [0;n) sequence, that's why they are quite common:
for(i = 0; i < 10; i++) { printf("%d\n", i+1000); }
gives you [1000; 1010)
for(i = 0; i < 10; i++) { printf("%d\n", i*2); }
gives you some pair numbers, which that notation we talked about can't express.
Note that
for(i = 0; i < 20; i+=2) { printf("%d\n", i*2); }
can do the same thing.
>>
>>53522549
Huh.

I need to look into this.

What are the requirements for interfacing with that API?
>>
i am coding some neural networks based on te perceptron model and i plan to train them with genetical evolution. for fun and eventually a game idea i have.

what are the best solutions to make a network take a decision based on a variable lenght array of elements?

for example i might want to train a soldier AI to choose and shoot enemies and coordinate with his teammates. every frame he might want to coordinate with 1-2-10-20 allies to choose the best out of many enemies to shoot at. what are my options aside for making a network large enough to always take into account the position of the closest 40 soldiers?
>>
>>53522557
doing IO willy nilly in your "parallel tasks" has a much bigger impact (orders of magnitude) on limiting your performance than false sharing; removal of false sharing is among the last performance improvements you can do to your code
>>
File: MCyIYPG.png (9 KB, 954x106) Image search: [Google]
MCyIYPG.png
9 KB, 954x106
>>53522549
>posting a blank image
>>
>>53522624
Oh, absolutely. I figured you were one of those people who aren't aware of
using static
.
>>
>>53522549
enjoy your place on the watchlist
>>
>>53522661
I trust Microsoft with my data.
>>
>>53522696
>they protect pedophiles' privacy
anon...
>>
The big confusion (IMO) about functional programming is that it really describes two orthogonal schools.

Firstly, it describes using first-class functions and higher-order functions, and making use of composition to build up complexity. This is the side of FP that is comparable to OOP, although they are not incompatible, either. This is the practically useful part.

The other side of FP is one that is in contrast to imperative programming, i.e. using lambda calculus as a basis, having pure functions, etc. This is the theoretically useful side, as it is what makes programs easy to reason about, although it's trickier to make them map to hardware (which is what IP is good at).

You really can't argue against the former, the same way you can't say "OOP is bad" or "PP is bad". It's a tool that all languages and programmers can and should use when appropriate. I believe the latter is the best way to go in the long run, but right now, you do have to make a choice between performance and provability. Just as imperative languages are progressively getting more safety features, functional languages are progressively becoming more efficient.
>>
How do i find duplicates in a vector<int>?
I'm on visual c++
>>
>>53522735
>homework
>>
Just learning the basics of python. What's the actual relationship between the
@property
decorator and the
property()
function? Are they always used together? Sample code from a tutorial follows:

class Circle2:
def __init__(self, radius):
self.__radius = radius

def __setRadius(self, newValue):
if (newValue >= 0):
self.__radius = newValue
print("Changing radius to {}.".format(newValue))

else:
raise ValueError("Value must be positive")

radius = property(None, __setRadius)

@property
def area(self):
return 3.14159 * (self.__radius ** 2)
>>
>>53522717
>you can't say "OOP is bad"
you can tho
>>
>>53522758
epic
>>
>>53522779
Most implementations of OOP are garbage but the concept is fine.
>>
>>53522772
They're the same thing.
@fancy
def f(): pass

is just syntactic sugar for
def f(): pass
f = fancy(f)
>>
>>53522578
>>53522468
You anon are a gentleman and a scholar, thanks for the explanation and for the code (it looks much neater than mine). Upvoted
>>
>>53522779
You can say that, but it wouldn't be objectively true, and even as an implied representation of your opinion only, it will make you seem silly and uninformed.

Consider an alternative:
>The way in which many people utilize OOP paradigms is reprehensible.
>>
>>53522772
Decorators are just a simpler way to call a function that takes a function as an arg

# This...
@decorator
def function(*args):
pass # Code here

# Is equal to
def function(*args):
pass # Code here
function = decorator(function)
>>
>>53522828
>make you seem silly and uninformed
I'd argue the ones drawing that conclusion are the silly and uninformed ones, in which case their opinion of me is irrelevant.
>Consider an alternative
I don't care for weasel words.
>>
>>53522868
Guns don't kill people. OOP doesn't write bad code.
>>
https://servo.org/
>Written in Mozilla's new systems programming language, Rust, the Servo project aims to achieve better parallelism, security, modularity, and performance.
Can Go and D even compete?
There's also this
https://github.com/redox-os/redox
>>
>>53518528
just use a cronjob. it will be better than whatever shitty script you concoct
>>
>>53522834
I don't really understand
why does `decorator()` need that arg?
is there any reason the variable is called `function`
>>
>>53522980
>Communism is great!
>Just that every implementation has been a disaster.
>>
>>53523002
>Can D even compete
As soon as Andrei implements some of that dank manual memory management, yes
>>
>>53523025
Poor analogy, because there do exist implementations and uses of OOP that aren't bad.
>>
>>53523025
But not every implementation of OOP paradigms is a disaster.

Are you even trying, woman?
>>
>>53519685
It's not a good starting point for a linuxfag.
>>
>>53523041
Please.
>>53523045
>OOP paradigms
You don't even know what you're talking about.
>>
>>53523045
>OOP paradigms
I shiggy
>>
File: raytraced.png (108 KB, 1000x1000) Image search: [Google]
raytraced.png
108 KB, 1000x1000
more progress. very fun project if interested in learning graphics. adding reflections next
>>
>>53523183
LOL BLINN PHONG NOT RAY TRACING RETARDED SPERG
>>
>>53523183
>adding reflections
don't you mean just adding another ray?
>>
Rate my code


public static void main(String[] args)
{
int n = 2744;
String moo = n + "";

String distance = "";
System.out.println(moo);

for(int i = 1; i < moo.length();i++)
{
distance += Math.abs(moo.charAt(i) - moo.charAt(i - 1));
System.out.println(distance);
}

int num = Integer.parseInt(distance);
System.out.println(num);


}

>>
>>53523197
why are you so worked-up, anon? did blinn and phong spit roast your crush?
>>
>>53523250
i'm channeling k tard java guy
>>
>>53523212
pass-by-reference/10
>>
>>53523209
yeah, that's how it's implemented, I don't understand what you're questioning?
>>
>>53523212
>java
It's shit
>>
>>53517645
Implement a shell that can handle piping and redirection, backgrounding and maybe some fancier features
>>
>>53523197
what shading model does 'real' ray tracing use, then? and don't just give me some 'muh photons' bull shit, give me the pseudo code for the diffuse and specular components.
>>
>>53523183
what libs/lang are you using?
>>
>>53522717
>This is the theoretically useful side, as it is what makes programs easy to reason about
This is wrong. It makes programs harder to reason about. The easiest programs to reason about are imperative programs with finite state and no recursion or jumps. All proofs about functional programming are about "spherical cows" which are poor approximations of real programs. Many of them don't even work properly when run, if they are able to run on hardware at all and not only "on paper."

>imperative languages are progressively getting more safety features
Imperative languages have always had safety features. Most safety features, including "refinement" types, checked exceptions, and specifications, came from imperative programming to functional programming after they were already used in industrial products. Some imperative languages are safe without runtime checks and this is based on a real program with real time and space constraints (finite or bounded bytes), not "spherical cows" which assume infinite memory, no errors, perfect I/O, no hardware failures, and other bogus assumptions. "Safe" still depends on working hardware, but imperative languages give you more control over what to do if something goes wrong. This is why the trend of "error values" coming from functional programming is such a mistake.
>>
>>53523303
akka with scala
>>
>>53523287
Le Java is shit meme. Seriously this meme needs to stop it is one of the best programming languages out there you hipsters and your non mainstream programming languages
>>
Hello dpt, please program a filechooser greasemonkey script with thumbnails. Thanks.
Thread replies: 255
Thread images: 21

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.