[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: 44
File: 1464632537832.png (152 KB, 1948x858) Image search: [Google]
1464632537832.png
152 KB, 1948x858
oop is pajeet-tier edition

old: >>55105007
>>
Wrong, OOP is based.
>>
>>55110925
Second for D
>>
Third for Go
>>
>>55110952
>>55110958
Wrong, at least if your D unironically uses the factory pattern

>>55110925
>>55110966
Correct
>>
File: comfy.png (167 KB, 376x328) Image search: [Google]
comfy.png
167 KB, 376x328
DAILY PROGRAMMING CHALLENGE

A simple program that shows all the prime numbers from 0 to a user inputted integer.
>>
>>55110925
If OOP is so bad then why do unis teach nothing but OOP?
>>
>>55111012
No. I've written the isPrime function too many times
>>
>>55111019
because they are training code monkeys, and code monkeys use java
>>
>>55110925
>that pic
literally the projects in my work, down to the logging framework. Holy shit OOP is a meme
>>
>>55111012
>DAILY HOMEWORK ASSIGNMENT
>>
>>55111046
It takes less than a minute to write it
>>
>>55111019
Unis are pajeet-tier.

Self-teaching is the way forward.
>>
File: GQVQJ.png (194 KB, 786x364) Image search: [Google]
GQVQJ.png
194 KB, 786x364
>>55110925
Without OOP, we wouldn't have the Power of .NET(TM) at our fingertips.
>>
>>55111065
I don't care, I've done it too often.
It is literally below me.
>>
>>55111088
>.NET
disgusting
>>
File: IC132267.gif (31 KB, 415x452) Image search: [Google]
IC132267.gif
31 KB, 415x452
>>55111117
>disgusting

You are mistaken. Please see this graph.
>>
>>55111159
>some random square grid means something
disgusting
>>
>>55111159
>2002

glorious
>>
>>55111159
>As of October 2002
Yepp
>>
>>55111088
>Power of .NEET
but you already had the power of making dog slow applications thanks to java
>>
>>55111159
What exactly is Microsoft's vision?
>>
>>55111169
>>55111259
>>55111262

This graph confirms that there is a high ROI if you go with Microsoft _and expect results_ (TM)

>>55111280
Yes, unfortunately. But Based Microsoft explains to businesses looking to make the switch that your job will remain intact even if you're maintaining some old pile of garbage Java application. .NET is the future.

Per Microsoft:

How to Get Started with .NET

Moving to a new technology is always intimidating for organizations. While .NET is very large, it is not that hard to migrate to. Since it will co-exist with your existing applications, there is no need to rewrite old applications. Simply write new applications in .NET and leave your older applications alone. However, there are several things you should do to prepare for your move to .NET.
>>
>>55111423
Complete dominance
>>
File: brain.jpg (93 KB, 800x451) Image search: [Google]
brain.jpg
93 KB, 800x451
>>55111423
>>
>>55111423
It used to be "a computer on every desk" but that one's done so they moved on to the next one: "money for our shareholders"
>>
>oop is bad
Yeah thats why everything is written in oop and very few things are mad in lisp and haskle
>>
File: 1410375365144.png (65 KB, 315x257) Image search: [Google]
1410375365144.png
65 KB, 315x257
>>55111088
>.NET ecosystem
>>
>>55111508
>there is only OOP and FP
k
>>
>>55111452
>.NET is the future of garbage
>>
>>55111545
Oh yeah procederal, thats better than oop too right? Kek. Any other programming model is a fuckin meme lang
>>
>>55111579
>there is only OOP, FP and procedural
lmao
>>
>>55111012
rate my isprime!
int isPrime(const int n)
{
if (n < 2)
return 0;
int i;
for (i = 2; i < sqrt(n); i++)
{
if (n % i == 0 && n != i)
return 0;
}
return 1;
}
>>
File: T2QZK.png (37 KB, 890x368) Image search: [Google]
T2QZK.png
37 KB, 890x368
>>55111541
>Implying Java's is better
>>
>>55111609
>Checking even numbers
It's shit.
>>
>>55111046
then you can do a different challenge: calculate the cross total of the factorial of a given number.

i.e: 5! = 120 -> 3

but your implementation should work for something like 5000! as well
(I once wrote it in js, took about 30sec for 5000!)
>>
>>55111640
If he didn:'t check all numbers he'd have to add a workaround for the number 2.
>>
>>55111726
>he'd have to add a workaround for the number 2
That's perfectly fine as a special case. By not checking even numbers in the loop, you reduce the number of comparisons you have to do by half.
You just need
if (n % 2 == 0)
return n == 2;

after the (n < 2) case.
>>
>>55111763
Why even modulo it?
If you already know 2 is prime, just return true if it's 2.
>>
>>55111797
By handling all even numbers outside of the loop, you can change it to
for (int i  = 3; i <= sqrt(n); i += 2) {
if (n % i == 0)
return 0;
}
return 1;


Also a few other notes. It's "<= sqrt", otherwise numbers like 9 will come out as prime.
"n != i" is guaranteed by the loop condition, so is pointless.
>>
>>55111611
why don't you write a better language then?
>>
>>55111657
>i.e
You mean "e. g."
>>
>>55111849
well alright.
the first one took 50 seconds to find the nearest prime starting from LLONG_MAX, 9223372036854775783

Yours took 25 seconds.
>>
File: 2.png (39 KB, 666x549) Image search: [Google]
2.png
39 KB, 666x549
>>55111917
forgot pic
>>
>>55111873

B-but Anon, Microsoft (TM) already has:
>>55111088
>>
>>55110925
"Leggable" Ahahha
>>
>>55111597
I clearly expressed anything other than these 3 are a meme and you fail to name anything else or even come close to how they could ever be superior to the 3 previously named. Go study for comp sci II faggot and quit shitposting
>>
File: helps.png (5 KB, 758x236) Image search: [Google]
helps.png
5 KB, 758x236
I need an algorithm that keeps my period roughly the same depending on the input size of a signal.

How do I do this? Pic related.

Either cos or sin solution. Shouldn't matter.

Preferably in Matlab, that's what I'm trying it in.
>>
I only have experience doing work in kernels and desktop applications, but I've been approached recently with making small websites for people (small as in I can probably get away with making it all static). I muck around with userstyles and scripts, but I've never really developed a formal stack or workflow from scratch.
Do I just go to town with simple hand-made html/css/js files or should I pick up some other stuff? It seems like if I actually want to impress people I ought to be using React, node, etc.
>>
>>55112191
Birth control is an effective way to regulate tour period.
>>
File: 1385916547781s.jpg (3 KB, 102x125) Image search: [Google]
1385916547781s.jpg
3 KB, 102x125
>>55112208
>>
File: 1465948993794.jpg (296 KB, 538x604) Image search: [Google]
1465948993794.jpg
296 KB, 538x604
>>55112270
Haha trolled u
>>
>>55112191
multiply x by a number to normalize the period.

For example, if the period is 2, multiply by x by 2. If the period is 5, multiply x by 5. That way the period is always 1.
>>
I have a programming assignment for a small game that allows you to tap cells in a colored grid to make them disappear. I'm having trouble keeping the score. The method for calculating the score is run at the end of the game.

I'm currently calculating score by running through the entire grid and counting all the empty cells. However, this doesn't keep track of all the rows that have been eliminated. Any tips?
>>
How come every time I get stuck and want to ask a question I figure it out immediately after I hit post?
>>
>>55112322
Try jquery it does all the things
>>
>>55112322
Give more detail and post code. It sounds like you need to update the score when a row is eliminated, not just at the end.
>>
>>55112322
pretty vague gonna need to see your code.
>>
>>55112344
Yeah, I was just having trouble as to where to keep track of eliminated rows because the method has to be run at the end of the game. But I just got a surge of inspiration that I think will work out. Thanks.
>>
>Fun fact: Even the pro C programmers use oo techniques when developing software
>>
>Fun fact: OOP is a just a software pattern it has little to do with the language
>>
>Fun fact: Javascript wouldn't be so shit if it implement real oop and not shitty prototyping
>>
>Fun fact: Dlang master race
>>
>Fun Fact: git gud
>>
>>55112417
true
>>
>>55112443
U combo breaker :/
>>
File: designated.png (242 KB, 813x801) Image search: [Google]
designated.png
242 KB, 813x801
Math is Pajeet-tier.
>>
File: asyncio.png (50 KB, 1071x649) Image search: [Google]
asyncio.png
50 KB, 1071x649
trying to wrap my head around python 3.5's new coroutine packages so I can be in control of the future
>>
>>55112477
>general relativity
>QFT
not math
>>
>>55110925
>weab shit is kill
Based op.
>>
>>55112497
>futures and promises
Python's "future" is Javascript's past ;^)
>>
>>55112501
Those are the apps. Math is the framework.
>>
>>55112514
>javascript
nice meme
>>
>>55112541
thanks
>>
>>55111939
How do people get out of high school not knowing this basic shit?
>>
>>55111939

I always read i.e. as "in example" and e.g. as "example given".
>>
>>55112731
You are wrong. Dummy.
>>
http://github.com/deeepaaa/hachidori
>>
>>55112706
>implying goverment school teach rather than indoctrinate
>>
>>55112771

Blah, fuck Latin.

http://www.quickanddirtytips.com/education/grammar/ie-versus-eg

Grammar girl suggests to use "in essence" to remember the difference. So I'm just going to read them as "in essence" and "example given."
>>
File: 1317251842582.jpg (19 KB, 214x320) Image search: [Google]
1317251842582.jpg
19 KB, 214x320
>>55112841
>>>/x/
>>
>>55112311

got it thanks. Not sure if your method was what I used, made me think about it more though.

a=1;
x=1:1:col;

p=col;
y=cos((2*pi)/p*x);
plot(x,y);
>>
>>55112731
Congratulations, you're retarded!

>>55112860
"Example given" doesn't make any sense. E.g. should be read as "for example".

It's worth remembering it just like that so you don't do something really stupid and use "For e.g." which reads as "for for example".
>>
>>55110925
Whats the best edge detection algorithm.
Also I need to get into making programs with guis. Should I get good with opengl. making your own widgets sounds like a pain but I dont want to deal with c# for winforms
>>
>>55113018

matlab edge(); LUL
>>
>>55112463
jesus fucking christ, >>>/9gag/
>>
Google doesn't give me anything on this specific error, similar errors are usually resolved by adding parenthesis to the method

TypeError: delete() takes exactly 1 argument (0 given)


Here is my route for delete in the controller:

@app.route('/delete', methods=['POST'])
@login_required
def delete(job_id):
if request.method == 'POST':
job = JobPost.query.get(job_id)
db.session.delete(job)
db.session.commit()
return redirect(url_for('home'))


Here is my view:

<form id=delform action="{{ url_for('delete', job_id=job.id) }}" method="post">
{#<input class="btn btn-xs btn-danger" type="submit" name="delete_job" value="Delete">#}
<a onclick="$('#delform').submit();" class="btn btn-xs btn-danger" id="delete_job" href="#">Delete</a>
</form>


Any reasons why this bullshit exists?
>>
Hey someone give me an alternative IDE to Visual Studio for C++
>>
>>55113087
http://stackoverflow.com/questions/31282297/render-template-takes-exactly-1-argument
>>
File: clion_logo.png (10 KB, 400x138) Image search: [Google]
clion_logo.png
10 KB, 400x138
>>55113182
A cross-platform IDE for C and C++ by JetBrains
>>
File: crawling_chaos.gif (623 KB, 360x263) Image search: [Google]
crawling_chaos.gif
623 KB, 360x263
I posted this in the other thread but got fugged by the split threads.

What's a good scripting language alternative to Python, which has easy FFI like Python does, but which actually has good capacity for multithreading, like Python doesn't?

Alternatively, what's the best Python-without-GIL implementation? Is it Cython, PyPy, or one of the weird fuckers which runs Python on another language's interpreter like Jython?
>>
>>55113182
>>55113206

forgot link
https://www.jetbrains.com/clion/
>>
>>55112995

>Congratulations, you're retarded!
Not really, that was how I was taught.

>"Example given" doesn't make any sense.
Well, if you're going to interpret it as something English that can be given an initialism, it's the only phrase that makes the most sense. Reading it as "for example" is counter intuitive because the first letter isn't f, and the second letter isn't e.

>It's worth remembering it just like that so you don't do something really stupid and use "For e.g." which reads as "for for example".
"For example given" also sounds retarded. Reading it as "example given," one further expands it out to "the example given is..."
>>
>>55113206
>>55113225
>US $199.00 /1st year'
Fuck that
>>
>>55113182
>Needing an IDE for C++
Its not Java, kiddo. Learn your shit
>>
>>55113247
Are you poor or something?
>>
>>55113259
Not willing to pay $200 for something I can do for free... Code::Blocks is capable, or just, like Vim or something.
>>
>>55113285
poor, got it
>>
>>55113241
>that was how I was taught
>Taking lessons from retards

>something English that can be given an initialism
Firstly, Latin doesn't map to English without adding in filler words, it's about as least verbose as you can get (in western languages anyway).
Secondly, why do you need an initialism, are you dyslexic? Not everything needs an initialism to be remembered, especially something this basic.
Besides, just say example in spurdo-speak and you get eggsamble, which starts with "eg". There, I made it memorable even for a dyslexic 4channer.

>one further expands it out to "the example given is..."
You're reading it as example given, but that alone isn't enough for it to make sense, so you have to add in "the" and use 3 words to explain a 2 letter initialism.
"For example" is already grammatically correct, probably because it is the English meaning of e.g.
>>
>>55113197
This doesn't help, I already know how to troubleshoot with which that post details, there is a problem with delete so I removed the job_id in the function, then I get a
NameError: global name 'job_id' is not defined
because it doesn't hook onto the variable in my view. I posted this because it's a uncommon issue, not because it's something that can be simply looked up on SO
>>
>>55113259
>>55113317
Typical American attitude, just throw money at everything and it will be fine.
>>
>>55113418
i used my wife's son alimony to pay for my C++ IDE.

you gotta make choices dude
>>
>>55113366
>just say example in spurdo-speak and you get eggsamble, which starts with "eg".
I will never forget about this in my entire life from now on
>>
>>55113370
Try this
@app.route('/delete/<int:job_id>', methods=['POST'])
>>
>>55113477
>Using an IDE and not just cat command
>>
As software becomes more and more complex, it also becomes more and more fragile. The only exception seems to be the internet, which has only become more reliable as it grows. The reason for this is the internet is inherently redundant - packets will find new routes to their destination if one is knocked out.

Will software devs adopt to this kind of redundancy? For example, rather than saving a variable in only memory (and open yourself up to loss due to computer crashes), software might save it to the local disk, to the cloud, and to memory. When the variable's value needs to be accessed, the program can check memory first, then the disk, then the cloud. If we mind our abstractions, doing this will be as simple as declaring and dereferencing a pointer.
>>
>>55113513
It now works but it's deleting the wrong ones you cunt
>>
File: 1464016776109.jpg (114 KB, 697x957) Image search: [Google]
1464016776109.jpg
114 KB, 697x957
>>55110925
>oAnimal
>o
>Hungarian notation
REEE
>>
File: Capture.png (82 KB, 858x1011) Image search: [Google]
Capture.png
82 KB, 858x1011
>>55111012
Think I got it to work. Thanks for the programming idea.
>>
>>55113549
But maybe I don't want to save all my variables on disk? Maybe that would be a huge waste of space?
>>
>>55113549
No, that sounds great.
Instead of simply reading a stack variable from the registers, now you can wait literally forever for a disk read, or better yet, WAIT FOR A TCP PACKET!
>>
>>55113583
Say you have 16gb of memory. You could save everything in memory to a 16gb flash stick for around $5. This is a very cheap operation.
>>
>>55113549
thats already a thing for computers in satellites and whatnot.
>>
>>55113602
You'd only need to do a disk read if the memory was corrupt or was lost somehow, for example after the computer was abruptly power cycled. If you hadn't written to disk, you'd be totally screwed - a slow read is only an improvement from that. Saving to the cloud means you can resume program operation even if the computer you were using was destroyed. Again, you'd read from memory by default, from disk or network in the case of memory failure.
>>
>>55113654
I don't understand why program persistence is such an important issue when the computer running the program has just been destroyed.

If your servers are suddenly destroyed, so will your disks, and you won't be able to suddenly download your execution state back from the CLOUDDD
>>
>>55110925
I'm too retarded to implement MVC correctly: the image. Shameful.
>>
http://github.com/deeepaaa/hachidori

sort of x-platform desktop widget
>>
File: 1465956604350.png (357 KB, 454x603) Image search: [Google]
1465956604350.png
357 KB, 454x603
So if you're developing a project in a language like C or C++ and are using external libraries (boost, SDL, etc), and you have it on a git repository, do you include the external libraries with your stuff on git? I'm not certain about the etiquette for this.
>>
>>55114099
No, that would be stupid.
Just tell your users to install their own libraries, that's the beauty of package managers.
>>
F* looks really cool. I wonder what the performance is like.
>>
File: scrot.png (5 KB, 436x104) Image search: [Google]
scrot.png
5 KB, 436x104
what do /dpt ?
>>
>>55114245
>error free code
>>
File: 3.png (12 KB, 874x192) Image search: [Google]
3.png
12 KB, 874x192
how do you comment your code?
>>
>>55110952
based on retardation
>>55111088
ironic how all the good .NET stuff is based on FP (LINQ = monads)
>>55114240
it is pretty nice :3 not sure about speed, never benchmarked it
>>
>>55114338
I guess, since it's extracted to OCaml, and is essentially just verified ML anyways, it must be somewhat along the same lines.
>>
>>55114331
if I'm implementing a standard, i just include snippets of the standard
otherwise, i leave comments for myself as to why I did things a certain way because I won't remember them in several months from now
>>
Why does everything in Objective-C starts with NS?

e.g. NSDictionary, NSStuff,..
>>
>>55114364
I think there's a certain amount of runtime overhead in situations where you mix total/pure code with effectful code, among other cases. although since it can be compiled to both F# and OCaml I wonder how the performance would differ based on the strengths of each compiler/runtime
>>55114424
stands for NextStep iirc
>>
>>55110925
Can confirm this image.
However, most large systems get ugly real quick.
>>
File: oh noes.jpg (99 KB, 784x810) Image search: [Google]
oh noes.jpg
99 KB, 784x810
Does digitalocean only charge you for the hours your server was running?

I wanted to dabble with some remote git hosting and I need port 80 open.
>>
>>55114440
>I think there's a certain amount of runtime overhead in situations where you mix total/pure code with effectful code, among other cases
I can't see why this would be the case...are effects not irrelevant?
>>
File: 123456789.png (287 KB, 599x450) Image search: [Google]
123456789.png
287 KB, 599x450
>>55114455
>>
>>55114331

That is awful, but for some reason, I don't actually hate it.
>>
>>55111012
Sieve of Eratosthenes should be most efficient solution, no?
>>
>>55114338
>LINQ
>good
Pick one.

Monad notation is just boilerplate for Haskell not having algebraic effects.
>>
>>55114121
I don't mean for deployment, I meant for development with other people.
>>
>>55114503

What's wrong with mongodb?
>>
>>55114490
I'm pretty sure some of the safety checks when going between total code and effectful code are implicit so there's some small overhead there
>>
File: finished_ll_parser.png (28 KB, 641x915) Image search: [Google]
finished_ll_parser.png
28 KB, 641x915
I finished my parser

It's not fast, it's not pretty, but it works damn well for a first version (not a single bug - granted that it's not a very hard thing to write, but still)
>>
>>55114566
>Document-oriented database

what is wrong with read() and write()?
>>
File: 009.jpg (89 KB, 500x500) Image search: [Google]
009.jpg
89 KB, 500x500
yo /g/, I'm making a tool that visually creates data structures of custom types. I currently support lists, queues, stacks, deques, and trees (n-ary by default with a tool pane for enforcing constraints like heap, binary search, etc.) I intend to add priority queues next and possibly graphs after that, but I come to ask: do you feel there are any data structures you would like to see that I am missing?

On the radar: set (would be pretty easy to implement and report collisions based on live hashing) and dictionary/map (might be hard due to the nature of the tool, but I might be able to pull it off)
>>
Apparently I missed something basic when I learned java. How can I just throw an exception without handling it? Everytime I try the compiler complains that it's unhandled.
>>
>>55114630
That reminds me of how much I hate writing fucking parsers. Had to do a simple parser that translated a formula such as "3*(x+1) - exp(4*x)" into a tree structure for a CAS I wrote. Such a disgusting thing to do with your time. Weeks after I thought I was finished with that piece of shit, I STILL found bugs in the parser every now and then.
>>
>>55114687
https://en.wikipedia.org/wiki/List_of_data_structures
>>
>>55114687
Tries

>>55114738
But parsing is fun anon, why don't you like it?
>>
In .net, how the fuck do you do run a Form gui on a new thread?
>>
>>55114708
I'm learning C++ and I was wondering the same thing

why don't I have to catch all the exceptions from a standard library class, but I absolutely have to for my shit?
>>
>>55114820

Use tasks so as not to interrupt the GUI thread.
>>
>>55114708

Switch to C# where you don't have to.
>>
>>55114833
Use tasks so as not to interrupt the GUI thread.
>>
>>55114708
say that your method throws the exception again

public void myMethod() throws ExceptionA {
//code which may throw ExceptionA
}
>>
>>55114485
Yes, it says on their site.
>>
>>55114868

I don't get it, lad. What's the point?
>>
>>55114708

Exceptions thrown are passed to the thread that called the thing that threw them. You can throw exceptions all day, but EVENTUALLY they're going to get caught by SOMETHING. That something is either your own program, someone else's program, or Java itself. That last one is what you don't want to happen, because the default thing Java does when it catches an exception is ABEND.

Sometimes you throw an exception and you're a retard who didn't realize his code was operating on, say, a button's thread. The button will catch any exception you throw to it, and it will deal with that exception by crashing the environment with no survivors.
>>
File: f89192d089.jpg (134 KB, 874x717) Image search: [Google]
f89192d089.jpg
134 KB, 874x717
>>55114868
>mfw I really thought you were the nigger lover
>>
>>55114945

Don't act like you don't like nigger women.
>>
>>55114950
"Women" usually refers only to humans.
>>
>>55110925
>Initialising a number with 0
>>
>>55114959

Black women are the best women, though.
>>
>>55113182
Dev C++
>>
>>55114758
Used it, was looking for opinions—what people like
>>
>>55114738
>>55114778
You should look into writing a parser in Haskell, I'm not even joking. I did a Scheme language parser in Haskell this past spring and it felt very intuitive.
>>
>>55114989
i like the fibonacci heap.

you probably can't implement it though
>>
/g/ why is .net so based?
>>
>>55114868
>Use tasks so as not to interrupt the GUI thread.
I don't have a main GUI thread - I have a console program and I want basically a command to open a GUI and I can't have it interrupt and halt the console thread.
>>
>>55115019
yep parser combinators are great, and if you're not into Haskell check to see if your language has a library for them because they're super nice to use
>>
>>55115047

Thread t = new Thread(() => (new Form1()).ShowDialog());


Then you can do whatever in your console thread and join to wait for the user to finish with the GUI.
>>
Perl is stuck on
Fetching with LWP:
http://www.cpan.org/modules/02packages.details.txt.gz


I have no idea why I can't get any single fucking module to install.
>>
>>55115019
>>55115193
>Writing a parser using a library

but where would the fun be in that
>>
File: 1464999012479.jpg (20 KB, 282x325) Image search: [Google]
1464999012479.jpg
20 KB, 282x325
If I made some encrypted chat system would you guys talk with me?
>>
>>55115227
>Writing a parser using a programming language

but where would the fun be in that
>>
>>55115249
sure. why not

i have no one to talk
>>
>>55115249
No, we're all busy talking on our similar but incompatible systems.
>>
File: errors.png (10 KB, 522x138) Image search: [Google]
errors.png
10 KB, 522x138
I have a probably simple problem.
I want to do something basically like this in C++:
class NodeHolder {
public:

class Node;

vector<Node> nodes;

class Node {
public:
int data;

void DoStuff() {
//Insert a new node
Node newNode;
::nodes.push_back(newNode);
}
};

};


So basically I have a bunch of nodes that are contained in the NodeHolder. Sometimes the nodes want to allocate new nodes, and I want them to allocate them by adding them to the parent class's vector of nodes.
So how can I access the parent class? Is there a better way I should be structuring this?
When I try to compile this, I get errors (pic related.)
>>
File: AkJo42H - Imgur.gif (584 KB, 640x400) Image search: [Google]
AkJo42H - Imgur.gif
584 KB, 640x400
I'm making some weird ASCII based graphics happen in C++.
>>
>>55115025
You're right; I don't think that the serialization would support that.
>>
Did I invest my $30 well?
>>
>>55114485
Well I think they always do a minimum charge and based how many hours it can go up
>>
>>55115341
>dat parallax
hnnng
>>
>>55115293
Okay, it looks like nested classes are completely independent, and I'll just have to pass a pointer to the vector to the DoStuff function.
>>
>>55115293

Make your NodeHolder be responsible for inserting new nodes, rather than Node. That way the function will have visibility of your nodes.
>>
>>55115341
hot damn! post source on github or something
>>
rate my fizzbuzz, I wrote it when an engineer was talking to me:

$Array = @(1..100)
ForEach ($Item in $Array){
If (($Item%3 -eq 0) -and !($Item%5 -eq 0)){
Write-Host "Fizz"}
ElseIf (($Item%5 -eq 0) -and !($Item%3 -eq 0)){
Write-Host "Buzz"}
ElseIf (($Item%5 -eq 0) -and ($Item%3 -eq 0)){
Write-Host "FizzBuzz"}
Else{
Write-Host $Item}}
>>
>>55115359
yes. i like that book
>>
>>55115341
Is that plain text that's being output into the CLI, or is that done in a similar fashion to Dwarf Fortress?
>>
>>55115381
what kind of awful vomit language is this
>>
>>55112706
>>55112841
>implying average /g/ user is finished high school
>>
>>55115403
powershell
>>
>>55114687
a dictionary is a set of strings with trees attached
>>
>>55115403

Looks like powershell?
>>
>>55115405
>tfw I have a masters in CS
>tfw minority

I regret even doing it desu, rather would have been a trade skill for work.
>>
>>55115367
After some consideration, I guess I like that approach better than passing in a pointer to the vector. Thanks for the advice.
>>
>>55115373
>>55115383

I haven't cleaned it up yet - it's the result of drunk late night coding and being bored.

https://gist.github.com/OllieReynolds/f125dd2f1a5e5d7eea7fb8f52e0a57f0
>>
>>55115416
Love me some PowerShell. I use it all the time at work.
>>
>>55115438
>tfw I have a MSc in Software Engineering
>tfw building own company
Life is good, man.
>>
>>55115465
Same here. It's gotten to the point that anything worth doing is done with powershell
>>
>>55111012
import math
print(isPrime(int(input())))
>>
>>55110958
>anon's mother was first for D
>>
>>55110925
OOP is good for one thing: abstract stuff in very well understood domains. That's why it works for, say, the Java standard library: data structures and algorithms that are thoroughly researched.

IRL, problems are not that well defined, and requirements change.
>>
>>55115674
Can be done without OOP
>>
>>55115741
Of course. But I think that was one of the reasons it got so popular. People saw that it worked well on that stuff, and thought it would work everywhere else.

GUI might be another place where it worked ok. FRP is far better, tho.
>>
>>55110925
Only plebs who can't into basic architectural principles end up like this tho.
>>
>>55115455
do you have a linux version?
>>
>>55114566
It's not relational, so it's uselessly slow and will lead to a plethora of bugs on about %95 of applications
>>
File: compare.png (113 KB, 998x500) Image search: [Google]
compare.png
113 KB, 998x500
what does /g/ think about my raytracer?
>>
>>55115791
>FRP is far better, tho.
So much better, the only thing that used it abandoned it.
http://elm-lang.org/blog/farewell-to-frp
>>
File: 1458630652020.png (67 KB, 350x320) Image search: [Google]
1458630652020.png
67 KB, 350x320
I want to make a REST API, probably with flask.
But I don't know what to make it for, what to do with it.
>>
>>55115909
How much programming experience did it take to make this? Want to be at this stage myself in the future.
>>
>>55116029
then you don't really want to make rest api
>>
>>55116029
What kind of post is this? It's like saying "I want to make a GUI but I don't know what the software will be". Then you can't really make the interface for it now can you?
>>
>>55116066
kek
>>
>>55116064

it's basically linear algebra (and a bit of recursion). Reference Image and most models (phong lighting, flatt shading) are from here http://www.cs.cornell.edu/courses/cs4620/2012fa/lectures/35raytracing.pdf
>>
>>55116184
>phong lighting, flatt shading

"Not a raytracer" - Steven Molyneux
>>
>>55116217
KEK
>>
Starting a new intermediate position in an enterprise on Monday, any tips from fellow anons on standing out properly, or should I just keep my damn mouth shut and work?
>>
I'm trying to learn perl and all I can think while going through this is "What the actual fuck"

It seems so damn useful but I can't for the life of me understand the internal logic behind all of these weird choices. Why are there like 20 different ways to write strings and arrays, but only a few unordinary ways to write hashmaps? What is the point of sigils, and why do subroutines mash arguments together as a list?

i'm not hating, it just seems so autistic
>>
>>55115909
Pretty nice
>>
How much do you guys feel you retain after reading a book?
>>
>>55116459
0 percent
>>
>>55114331
constant comments to remind myself so I don't go full retard every time I come back
>>
>>55116459
About enough to feel confident that I can perform in relation to the topic without needing to refer back to the material, but not enough to be able to perform in relation to the topic without needing to refer back to the material.
>>
>>55116459
When reading a reference book, I do multiple readings. The first reading is to get introduced to the language in the book. The next reading reinforces the ideas that I want to extract from the book. The third reading clarifies little details about the subject matter that I'm reading.
>>
from bs4 import BeautifulSoup
import urllib.request as urllib2
import os

url=input('Url of thread:')

headers='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36'
req=urllib2.Request(url,headers={'User-Agent':headers})

try:
html = urllib2.urlopen(req,timeout=20).read()
soup=BeautifulSoup(html,'html.parser')
print('\n'+soup.html.head.title.text)
except Exception as e:
print('Error',e)

arr=[]

for element in soup.findAll('a'):
if element.get('title') == 'Reply to this post' and element.parent.get('class') == ['postNum', 'desktop']:
arr.append('>>'+element.text)

f=open('out.txt','w+')
for element in arr:
f.write(element+'\n')
f.close

print('\nYour file is labelled out.txt')


now even you can spam threads easily
>>
>>55116615
Same here, heh
>>
What's a good resource to learn about formal verification
>>
>>55110925
Gonna attempt to implement logistic regression using newtons method in octave

Wish me luck
>>
>>55112191
Try a tampon.
>>
>>55116895
GOOD LUCK!! YOU CAN DO IT!
>>
>>55116893
I did a formal program verification paper in University.
The textbook for the paper was "Logic in Computer Science - Modelling and Reasoning about Systems" second edition by Michael Huth and Mark Ryan.
I never actually read it myself, but I assume it contains all of the information about that sort of stuff.
>>
>>55116895
>In statistics, logistic regression, or logit regression, or logit model[1] is a regression model where the dependent variable (DV) is categorical.
Ahh, now I see. Good luck.
>>
>>55113549
You don't know what you're talking about.
>>
>>55111012
let primed p =
let fact = mpz_t.Factorial (p-1) + 1
mpz_t.op_Modulus(fact, p) = 0Z

let primenum n =
[1..n] |> List.filter (fun i -> primed i)

primenum 10000 |> printfn "%A"
>>
>>55113654
And how the fuck are you going to determine whether it's corrupt you stupid fucking retard?
>>
I posted yesterday about wanting to thoroughly learn a new language so I'm not just seen as a web guy. I wanted to do one of the newer languages just because it's more interesting, and after considering Julia, Scala, Rust, Haskell (not new I know), Crystal, Kotlin, and a couple others, I have decided on.........Rust. It seems like the only one out of the newer languages that is for sure going to be at least relevant 10 years from now. I think I'm gonna take someone's suggestion from yesterday and implement coreutils in it for practice.
>>
>>55116962
Thank you friend

>>55116987
It's part of machine learning, it is basically creating a trend line to decide which category an input should go into.
The math pains me because I am no mathematician
>>
>>55113549
You know the reason we don't just use the hard drive as memory is because it would be slow as fuck
>>
>>55113549
>what is distributed computing
>what are different costs for writing to different kinds of memory
>>
>>55113549
Ill-informed philosophizing about technology isn't programming.
>>
>>55116977
I'll check it out, thanks
>>
>>55113549
>The only exception seems to be the internet, which has only become more reliable as it grows.

The internet is 'reliable' because it's over engineered. Big ISP's would rather build more or bulker routers to handle traffic than come up with an efficient one that handles loads when over ~60-70%.

If they actually didn't over engineer it, we'd have an unstable shitstorm.
>>
>>55116893
you mean like event-B type shit?
>>
>>55116893
learn F*
https://www.fstar-lang.org/
>>
File: poop1.png (329 KB, 1920x978) Image search: [Google]
poop1.png
329 KB, 1920x978
>>55110925
HUMANS AREN`T ANIMALS!!!!!!!
>>
>>55110925
Just because pajeet uses something wrong, doesn't mean it's bad.
>>
>>55117251
No, OOP is inherently bad.
It leads to horrible things like shared-state.
>>
>>55117268
PROVE IT FAGGOT.
>>
>>55115249
only if it's free as in freedom

>>55115280
poetic
>>
>>55117289
Come on, you know programmers can't into proofs
>>
>>55117289
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>55117329
Oh this retard again. "Hurr durr muh Pajeet used it wrong therefore no one can.".Yeah, my ass bitch.
>>
Can someone help me and tell me why my model doesn't refresh and show me the last person I added unless I end the program and run it again ?


if(nomEmp!=null && prenomEmp!=null && adresseEmp!=null && villeEmp!=0 && cpEmp!=0)
{
Employe emp = new Employe(nomEmp, prenomEmp, adresseEmp, villeEmp);
boolean bol = daoEmp.insertEmploye(emp);


if (bol == true)
{
JOptionPane.showMessageDialog(this, "Ajout de l'employé confirmé", "Confirmation", JOptionPane.OK_OPTION);

}
else
{
JOptionPane.showMessageDialog(this, "Erreur pendant l'ajout de l'employé", "Confirmation", JOptionPane.OK_OPTION);
}
}
else
{
JOptionPane.showMessageDialog(this, "Un des champs est vide", "Erreur",JOptionPane.WARNING_MESSAGE);
}
myEmploye.fireTableDataChanged();

>>
>>55117355
Nice counterargument, fuckface.
>>
So /dpt/, I'm trying to become a programmer.

I'm learning Java and Lua first, (Java is required by a computer scinece course I'm taking), and Lua because it's easy.

After learning a few languages, how should I start getting into writing programs and hacking? [spoiler]white-hat[/spoiler]
>>
>>55117391
>learning a programming language
>not writing programs
You can't learn a programming language without writing programs for it
>>
>>55114542
Yes it is. Using modulus ends up chugging at about a million.
>>
>>55117408
I have written some. I wrote a dice-rolling program in java. It just picks a random number between 1-6 when you press "a". I wrote a side-scrolling shooter in Lua, but have since lost the code.


What programs shoould I start writing as practice, per your suggestion?
Thread replies: 255
Thread images: 44

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.