[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: 334
Thread images: 22

File: The_Pragmatic_Programmer.jpg (23KB, 398x499px) Image search: [Google]
The_Pragmatic_Programmer.jpg
23KB, 398x499px
What are you working on, /g/?

Previous thread: >>59700932
>>
>>59707769
/prog/ has been gone for years anon...
>>
>>59707776
Lisp is the most powerful programming language.
>>
>>59707776
c++ coming through.
>>
>>59707786
No, just a month or so.
>>
File: 1463696945268.png (25KB, 396x400px) Image search: [Google]
1463696945268.png
25KB, 396x400px
>>59707776
Is that a good book?
>>
>>59707820
Personally, I don't think it's that great. I also don't like SICP that much either, so take that for what it's worth.
>>
>>59707845
What didn't you like about it?
>>
about to start learning my first language (C)
wish me luck
>>
>tfw i'm a faggot piece of shit
>>
>>59707863
Why did you copyright the word "language"?
>>
>>59707863
Learn Lisp.
>>
File: 12ergtfhn.png (5KB, 600x600px) Image search: [Google]
12ergtfhn.png
5KB, 600x600px
Why is Java this color in Github?
>>
>>59707887
we both know why :^)
>>
>>59707881
should have been more clear
copyrighting 'my first language'
>>
>>59707887
because its shit
>>
File: INBvStO.png (312KB, 506x662px) Image search: [Google]
INBvStO.png
312KB, 506x662px
Why is insert sort so shit. I mean I expect it to be slower than merge or quick but good god
>>
I need to write a VGA/SVGA driver
http://wiki.osdev.org/VGA_Hardware
http://www.osdever.net/FreeVGA/vga/vga.htm
holy fucking shit why did this have to be so complicated? I don't even know where to start.
>>
The guy behind Idris is the guy who wrote Whitespace

Wew
>>
>>59707936
Just use a teletype instead. Or even better, use an OS with no I/O.
>>
>>59707968
holy shit thanks
>>
>>59707887
poo.init()
>>
How do you feel about higher order conditionals?

if (!(err = (a > b) ? func1(a) : func2(b)))
>>
>>59707887
Common Lisp is green master race
>>
>>59708177
Is C++ the gay pink one?
>>
>>59708146
It's so in its own world that I can't imagine why you would want to create it

Also, it reads retro-actively no matter what language you come from

Why does this exist?
>>
>>59708177
C# is green too.
>>
>>59708146
Literally why?
>>
>>59708214
Yes, C++ is pink
C is a grey
Python blue shade
Obj-C another blue shade
>>
If you don't have more followers on GitHub than you have on Facebook, Instagram, Twitter or any other social media website, then you're not a programmer
>>
>never have any ideas for projects
What do?
>>
File: quasiAI.jpg (3KB, 259x194px) Image search: [Google]
quasiAI.jpg
3KB, 259x194px
>>59707776
Any chance you could help me with a simple java program? im trying to make a quasi AI, in which if you type in a query, it searches a two-d array for the responce. that part is easy, but i want to make the fake AI "learn". i want to do this by making it so that if it hasnt heard a responce before, it saves it in a txt file and the nasks the user for the proper responce to the question. By doing this, the bot has now "learned" that responce. Help anyone?
>>
>>59708330
>learn machine learning
>learn natural language processing
>interpolate between simple wikipedia and wikipedia to create different levels of understanding for different readers
>>
Hi. Im very new to this. Attempting to code Conway's game of life in Java. First iteration works flawlessly, second iteration fucks up.


https://hastebin.com/ixomaqahol.java

Anyone have any ideas? I feel like this is very simple.
>>
>>59708320
post your github
>>
>>59708342
https://www.tutorialspoint.com/java/java_basic_syntax.htm
https://en.wikipedia.org/wiki/Trie
ok good luck
>>
>>59707776
I was working on this for a thread that died

>>59706705
// a number is prime if it can only be evenly divided by itself and 1
<code>
Tot = 0
For a=1; a < 100; a++(
For b=2; b < Int(a/2)+1; b++(
If a/b == int(a/b)
Goto notprime
Next b
Tot+=a
Notprime:
Next a
</code>

I'm sorry Boss please excuse my phoneposting Boss it's off the top of my head Boss please don't fire me Boss I'll let you do anything to OPs mother Boss
>>
>>59708342
>responce

Also what's the hard bit? You may want to use JSON for storing results for easier serialization, but other than that I don't see what's the problem
>>
>>59708360
I'd rather not, thanks
>>
>>59708387
The hard bit is transfering the data from the .txt file into the two-d array. im not sure exactly how to do it.
I will def look into JSON for storing though
>>
>>59708404
pleb

check out mine

https://github.com/CoralineAda
>>
>>59708416
Why do you want a 2D array instead of a hashtable?
>>
>>59708423
i want a 2D hashtable
>>
>>59708421
At least her projects are coding projects*, and not shitty markdown lists and tutorials and other BS


* Even if it's Ruby
>>
Is there any point to implementing Insertion Sort with binary search for inserting portion or is there really no gain?
>>
>>59708433
why? Whats two dimensional about
question -> answer
>>
>>59708423
im rather new to java, so thats around the limit of my "skills". also, 2-d arrays are just easier to visualize i find

https://hastebin.com/cenameburi.java
this is what i have so far. any upgrades will very much helpful
>>
>>59708433
std::unordered_map<std::unordered_map<thing>>
>>
>>59708442
Is there any point in anything?
>>
>>59708454
%s/responces/responses/g
>>
>>59708438
>her
>>
>>59708442
there is no asymptotic gain, and there is very little exact gain.
>>
>>59708146
Could you provide an example of where this would be useful in real code?
>>
>>59708421
Here's mine: https://github.com/Charlotteis
:3
>>
>>59708503
Are all trannies ruby/js devs?
>>
>>59708503
hello :)

https://github.com/jenniferlynparsons
>>
>>59708357
Without even reading it, have you made sure that the cell transitions are atomic? That's a problem a lot of people have, in the rules of the game all transitions are supposed to happen at once, but in many naive implementations people make the mistake of applying transitions immediately as they loop through the array of cells, such that the neighbor count of later cells is influenced by the transition of earlier cells in the same turn, which isn't how it's supposed to work.
>>
>>59708442
If you can insert elements in logn or c time then this will make the algorithm nlogn, but with arrays thats not the case, arrays take O(n) to insert so they would still be n^2
>>
>>59708498

Not him but maybe ...
if (!($couldnotetax = ($normaltax > $alternativeminimumtax) ? NoteNormalTax($normaltax) : NoteAltMinTax($alternativeminimumtax))) {
// error - tax couldn't be noted try again later?
}
>>
>>59708532
I ensured that would not happen by using two arrays. Neighbors are checked via the first array and, are applied to the second array. The first array is then made identical to the second. The first iteration works fine, but for some reason resetting the second array to be all false causes major issues.
>>
>>59708498
exception handling for 2 different kinds of inputs.
>>
What are your career goals?

mine:
1.) Get a job at a defense contractor in Northern VA

2.) Get paid >=100k

3.) Get my own place

What aboot you goys?
>>
>>59708146
I programmed a lambda calculus elevator and used this pattern with a depth first search function in order to perform beta reductions, it worked pretty well.
>>
>>59708605
1) get a job
>>
>>59708612
evaluator ** autocorrect
>>
>>59708612
>>59708628
i love me so elevators
>>
File: network-topology.png (351KB, 2247x2220px) Image search: [Google]
network-topology.png
351KB, 2247x2220px
someone else made this but it's related to a project of mine.
it's a diagram of the network topology of nntpchan over the past 4 years
>>
File: 1491112187110.png (164KB, 522x367px) Image search: [Google]
1491112187110.png
164KB, 522x367px
>>59708620
this
>>
>>59708670
Is it possible to draw that graph without crossing lines ?
>>
File: network-topology2.png (98KB, 1139x1139px) Image search: [Google]
network-topology2.png
98KB, 1139x1139px
>>59708670
and the current network topology
>>
>>59708700
it would be extremely autistic
>>
>>59708718
for whom?
>>
>>59708718
4u
>>
>>59708700
i tried to find a k5 or k3,3 but its too fucking messy to look at for long
>>
>>59708700
Amusingly, that's an NP-problem. Finding the answer to it is the same as solving it.

https://en.wikipedia.org/wiki/Crossing_number_(graph_theory)
>>
>>59708761
i mean you could, if you draw them in 3D
>>
>>59708761
Hes just talking about simply planarity though, which can be decided in O(n)

https://en.wikipedia.org/wiki/Planarity_testing
>>
Writing a network stack for an embedded RTOS
>>
>>59709462
for what purpose?
>>
I'm planning to make a program that downloads all of the images on a page.

Some pajeet's project I looked at uses multithreading for the downloading but personally I don't think that makes sense because bandwidth and writing to disk are the bottlenecks so surely using a single thread would be better to avoid sharing and slowing everything down.

Am I right on this one?

I guess my final plan would be to have multiple independent threads scrape all the pages and find the image links, then they send these to a queue which a single thread reads from and downloads the images.

Is that an efficient solution?
>>
>>59709462
editor?
>>
>>59709725
VSCode I think?
>>
>>59709611
Shits and giggles
Learning OS development and embedded programming

>>59709725
Most basic Atom install
>>
>>59709462
why c though?
we have c++17 nowadays.
>>
File: 1404947307314.jpg (134KB, 1280x720px) Image search: [Google]
1404947307314.jpg
134KB, 1280x720px
>>59709775
>This post
>>
>>59707776
Working on my imageboard: 4kev.org
Send banners pls
>>
>>59709775
In embedded programming you don't have a standard library, you have to write everything from scratch (like threads for example, I had to write my own scheduler). You also have to implement memory management very early on, something that can be done a little later and easier in C

>>59709798
Why point and laugh? Explaining works better
>>
>>59709936
> Explaining works better
Well yeah. If you actually know enough to be able to explain it.
>>
>>59707776

Will studying algorithms practically help my programming? I did some basic stuff like sorting algorithms and shortest path problems in college. Should I just concentrate on practical programming or do more theory?
>>
>>59710013
Practical programming.

Theory is good, but not worth much if you're not confident with your tools to apply it.
>>
Just tested the meme that you can calculate pi by randomly generating 2 numbers and checking if they're coprime.

function coprime(a, b) {
return gcd(a, b) === 1;
}

function gcd(a, b) {
var r = Math.min(a % b, b % a);

if(r === 0) {
return Math.min(a, b);
} else {
return gcd(Math.min(a, b), r);
}
}

function rand(max, min) {
return Math.floor(Math.random() * (max - min)) + min;
}


var coprimeCount = 0;
var d, d2;
var iterations = 1000000;

for (var i = 0; i < iterations; i++) {
d = rand(100000000, 1);
d2 = rand(100000000, 1);

if(coprime(d, d2)) {
coprimeCount++;
}
}

console.log(Math.sqrt(6 / (coprimeCount / iterations)));



Pretty insane how close it gets to pi desu.
>>
>>59709815
nice, anon
>>
>>59707863
seriously, learn a language with functional paradigms and learn about how to use them
>>
>>59710184
>functional
>it's actually impractical
lol
>>
>>59709722
Some image servers are slower than others
>>
>>59710207
It's practically the only way you'll get anywhere with large scale parallel computing systems
>>
File: consirasee.jpg (51KB, 326x326px) Image search: [Google]
consirasee.jpg
51KB, 326x326px
>>59710264

That's a fair point
>>
>>59709815
>4kev.org

Looks great - well done
>>
Why is swift so fucked up?

Anyone who creates apps for ios and says they enjoy it are fucking liars. Especially after seeing how easy android makes it.
>>
File: 1483119009765.png (145KB, 380x526px) Image search: [Google]
1483119009765.png
145KB, 380x526px
On Windows, is there something special I need to do to write to a process' static data in memory? I'm writing a shitty debugger that attaches to a program using OpenProcess with PROCESS_ALL_ACCESS to attach to a target, but I still get an error 998 access violation when trying to modify sections like .text and .data using WriteProcessData.
>>
>>59710594
android dev is torture too
>>
File: 19sd.jpg (372KB, 827x1168px) Image search: [Google]
19sd.jpg
372KB, 827x1168px
What do I write in C for practise?
>>
>>59710626
A compiler.
>>
Unironically, is there any reason to hate on C++17?
>>
>>59710632
That's a good idea anon, I will have lots and lots to study about parsing in particular.
>>
>>59710636
no
>>
>>59710626
A Rust compiler.
>>
>>59710130
It's not a meme. It comes from the Riemann zeta function.
>>
>>59710656
>Riemann zeta
is that the weird one that states 1+2+3+4+5+... = -1/12?
>>
>>59710643
The 8cc code base is relatively understandable if you ever get stuck.
>>
>>59710652
n-no..
>>
>>59710636
Where can I get the quick rundown on C++17? I think there used to be a github repo with some examples.
>>
When is the next C standard coming?
>>
>>59710761
Probably 2021 or so.
>>
>>59710652
fuck off rustfag, were talking about C here
>>
>using switch statement.
>put code below the break statement

why am I so bad at this? why do I do these things?
>>
>>59710915
You're writing too automatically, most likely. Try to think each step of the way by going back a couple of steps and considering all code paths. It'll FEEL slower, but you'll spend infinitely less time debugging.
>>
File: 2017-04-03_04-02-26.png (17KB, 630x310px) Image search: [Google]
2017-04-03_04-02-26.png
17KB, 630x310px
Why do white programmers with long pinus choose the most phallic language and why is it python?
>>
>>59711102
>wow snakes look like a penis xDDDD
>>
I'm getting demotivated learning programming. I've already finished C, A Modern Approach
and did a majority of the projects there and don't know what else to do. Every program
that somebody would need or want has already been done both on linux and windows, and
I'm not at a level of knowledge yet where I can contribute to existing programs.
I'm just going to give up programming because now I see how worthless (outside of a job)
and uninteresting it is. Is this really all you guys do here? Do simple and worthless small
programs and circle jerk over which programming language can do FizzBuzz the best?
>>
>>59711231
>Every program
>that somebody would need or want has already been done both on linux and windows
Linux still doesnt have an audio player comparable to foobar.Widows still doent have a good package manager. Among many other things
>>
>>59711231
>Every program that somebody would need or want has already been done
not true.
>>
>>59711266
Then give me a programming idea that has never been done before on linux (besides theoretical things like the halting problem).
>>
>>59711231
do something that has been done before, but do it better
>>
>>59711265
>Linux still doesnt have an audio player comparable to foobar.
Clementine
>>
>>59711307
Can you rice it yet?
>>
>>59711291
an actually good midi/osc sequencer that supports obscure hardware sysex out of the box
that's what I'm working on at least.
>>
When i finish a project I post it here to see if there's a more efficient way of doing the program.

Does that bother you guys?
>>
>>59711498
no, its encouraged
>>
What is the point of prototyping in other languages? Why would you want to write something once and then rewrite it again? Even if you find flaws along the way isn't doing it once with the language needed easier in the end anyway and you waste less time?
>>
>>59711577
Some languages are more expressive than others.
>>
>>59711517
            if (evens)
{
do
{
Console.Write("Will the next number be higher or lower?", CurrentNum);
choice = Console.ReadLine();

switch (choice)
{
case "higher":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum < NextNum)
{
CurrentNum = NextNum;
break;

}
else if (CurrentNum == NextNum)
{
CurrentNum = NextNum;
break;
}
else
{
CurrentNum = NextNum;
Lives--;
break;
}
case "lower":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum > NextNum)
{
CurrentNum = NextNum;
break;
}
else if (CurrentNum == NextNum)
{
CurrentNum = NextNum;
break;
}
else
{
CurrentNum = NextNum;
Lives--;
break;
}

}

Console.WriteLine("You have {0} lives left.", Lives);

} while (Lives > 0);
>>
>>59711602
I have an else statement thats basically the same thing except the results are the opposite.

There's probably a more efficient way to handle this.

also the language is c#
>>
>>59708438
What's wrong with Ruby? It's a pretty mature language by now.
>>
post programming music
https://soundcloud.com/daxxtrbs/lotus-iii-miami-ice-2015
>>
>>59711641
Why program in Ruby when you can program in Lisp?
>>
>>59711231
Who gives a shit whether or not the program has been "done before". Everything has been done before if you broaden it up, yes, but has it been done in the same way? Emacs is not the exact same as vim, they're completely and entirely different from code to functionality, to binds, etc. They're argued over constantly. And yet they're both text editors and one existed before the other. You develop things that you need or want specifically. Alternatives to current software, rewrites of outdated shit, patches and contributions to maintained shit, etc.

Recently I wrote an addon that refreshes given tabs and looks for a text string on an interval and notifies when done, because I needed it for something very specific and there was only one giant, outdated and bloated piece of shit on Firefox. So I wrote it in webextension. It's bene done before, but not how I wanted it.
>>
>>59711630
post the whole code not just bits
>>
>>59711602
atrocious
>>
>>59711646
>music while programming

can't concentrate fo shit
>>
>>59711697
I'd have to make like 3 posts.
1 sec.
>>
>>59711706
pastebin it
>>
>>59711697
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HighLow
{
class Program
{
static void Main(string[] args)
{
int[] cards = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
int Lives = 3;
Random RNG = new Random();
int CurrentNum = cards[RNG.Next(0, 11)];
int NextNum;
String choice;
bool evens;

Console.Write("Lets flip a coin!");

if (RNG.Next(0, 1) == 1)
{
evens = true;
Console.WriteLine("The coin landed on heads! \neven numbers don't lose lives.");
}
else
{
evens = false;
Console.WriteLine("The coin landed on Tails! \neven numbers lose lives.");
}

Console.WriteLine("The first number is " + CurrentNum);
>>
>>59711722
if (evens)
{
do
{
Console.Write("Will the next number be higher or lower?", CurrentNum);
choice = Console.ReadLine();

switch (choice)
{
case "higher":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum < NextNum)
{
CurrentNum = NextNum;
break;

}
else if (CurrentNum == NextNum)
{
CurrentNum = NextNum;
break;
}
else
{
CurrentNum = NextNum;
Lives--;
break;
}
case "lower":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum > NextNum)
{
CurrentNum = NextNum;
break;
}
else if (CurrentNum == NextNum)
{
CurrentNum = NextNum;
break;
}
else
{
CurrentNum = NextNum;
Lives--;
break;
}

}

Console.WriteLine("You have {0} lives left.", Lives);

} while (Lives > 0);
}
>>
>>59711646
https://www.youtube.com/watch?v=cF7QZM0HLhc
>>
>>59711734
else
{

do
{
Console.Write("Will the next number be higher or lower?");
choice = Console.ReadLine();

switch (choice)
{
case "higher":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum < NextNum)
{
Console.WriteLine("The number is {0}", NextNum);
CurrentNum = NextNum;
break;
}
else if (CurrentNum == NextNum)
{
Console.WriteLine("The number is {0}", NextNum);
CurrentNum = NextNum;
Lives--;
break;
}
else
{
Console.WriteLine("The next number is {0}", NextNum);
CurrentNum = NextNum;
Lives--;
break;
}
case "lower":
NextNum = cards[RNG.Next(0, 11)];
if (CurrentNum > NextNum)
{
Console.WriteLine("The number is {0}", NextNum);
CurrentNum = NextNum;
break;
}
else if (CurrentNum == NextNum)
{
Console.WriteLine("The number is {0}", NextNum);
CurrentNum = NextNum;
Lives--;
break;
}
>>
>>59711705
same
I like music while I compile shit though
>>
>>59711748
oops
 else
{
Console.WriteLine("The number is {0}", NextNum);
CurrentNum = NextNum;
Lives--;
break;
}
}
Console.WriteLine("You have {0} lives left.", Lives);

} while (Lives > 0);
}

Console.ReadLine();
}
}
}


thats it.
>>
>>59711646
You dumb CIA nigger.
I read that as "post-programming music" as in music after programming.
It's suppose to be "Lets post programming music", do you speak english nigger?
>>
>>59711788
>getting mad because of your failed reading comprehension
hyphens exist for a reason, if he meant post-programming music he would've put that there. The verb is seperate from the noun.
>>
>>59711760
what a shitfest

post the whole in pastebin fag
>>
>>59711231
>Every program that somebody would need or want has already been done

So? It's most likely crap. Try to use it and you'll realize what sucks and what doesn't. Look at their source code to learn how its done. Then reimplement it in a way that doesn't suck.
>>
>>59707786
I already knew that, but I realize now why we've had a sudden surge a functional tards the last few years.
We need /prog/ back, so we can send all the retards back there.
>>
>>59711660
Because I like Ruby?
>>
>>59711864
fuck you
>>
>>59711858
t. OOP tard.
>>
so in c++ how do I make an init 2d bool area all be set to false?

I tried both of these, but they do not work. I thought they auto set to false, but nope. I looped through it and some of them were set to true which messed up my code.

I know I can just loop through it and manually set it, but just looking for a quicker way.

bool bools[rows][cols];
bool bools[rows][cols] = {{false}};
>>
>>59711832
>>59711718

https://pastebin.com/w8cSwXmd

my bad.
>>
>>59711899
VLAs are not a feature of C++.
>>
Say I'm tasked to write a object tracking program in Haskell and the goal is to track an object as it flies through 3d space and make some decisions as it does. From my understanding of Haskell and the functional model in general you don't want to mutate stuff so anytime this object's location changes does that mean I'll need to rebuild the entire object and copy over data just to update it's location coordinates?
>>
>>59711926
And people claim that functional programming is efficient. Kek.

Also,
>Tasked
>Haskell
You take orders from yourself?
>>
>>59711926
what the fick

is this a college assigemnet?
>>
>>59711821
No, my confusion was not from lack of reading comprehension
because "post programming music" is easily mistaken for
"post-programming music" because "post programming music"
is not a complete sentence while "Lets post programming music." is.
>>
Should I join ACM or IEEE?
>>
>>59711988
it's a command u fuckin tard
>>
>>59711966
>>59711961
It's for research for work and thanks to some senior coworker who used to do this stuff haskell is now the language they do testing in. It's just for testing our decision algorithms before we go ahead with them.
>>
>>59711902
lot's of repeated code that could be done in a single function

it's ok to be this dumb in the beginning. don't worry
>>
>>59712001
Keep telling yourself that.
>>
>>59712008
I thought about that, I just.. didn't do it. though it would make it over complicated for some reason.

How would you do it?
>>
>>59712050
>>59712008
as in what part(s) would you put in a function.
>>
>>59711988
Now this is autism
>>
>>59711899
std::deque<std::deque<bool> bools { rows, std::deque<bool> { cols, false } };
>>
File: 1468551288516 (1).jpg (35KB, 456x456px) Image search: [Google]
1468551288516 (1).jpg
35KB, 456x456px
>>59712115
what the fuck C++
>>
There is nothing wrong with Python
>>
>>59712115
std::deque<std::deque<bool> bools {
rows,
std::deque<bool> {
cols, false
}
};
>>
>>59712063
coin_flip()
higher_lower()


Use ternaries and start getting in the habit of localizing all your variables. For the sake of portability.
>>
>>59712160
you forgot a >
>>
>>59712155
Python 2 vs 3 alone is enough to not use python
>>
File: 1491110787450.gif (73KB, 500x541px) Image search: [Google]
1491110787450.gif
73KB, 500x541px
>>59711231
If i could i would create a Notepad and a Image Viewer with the best performance i could achieve.
something simple but efficient, not fancy but good looking.
That's my philosophy
>>
Whats the best widget toolkit that isnt QT?
>>
>>59712221
>That's my philosophy
Does it imply atheism, theism or neither?
What is its position on essence and existence?
Is it materialistic? Dualist?
Does it give way to any kind of morality?
>>
>>59712242
>Does it imply atheism, theism or neither?
>What is its position on essence and existence?
>Is it materialistic? Dualist?
>Does it give way to any kind of morality?
it don't
>>
im calling an array from another class to read its elements

is it better form to call the entire array and store it in a temp array then read through each element or call each element as I need them from the other class. This is assuming I need to read every element in the array.
>>
Functions that take no arguments and return no values are bad practice.
>>
>>59712264
You mean procedures?
>>
>>59712264
Not if the organization of your program and the name of the function clearly defines a state manipulation.

spaceship.incrementVelocity();
>>
>>59712278
I think he meant methods
>>
>>59712264
As long as theres no mutability happening its still pure.
>>
>>59712264
You could really just boil your argument down, you're saying that "global/shared state is bad".
Yes, most people will agree with that, but sometimes it's justified.
>>
How would you go around writing a python script for batch downloading images (one after other, so it won't choke the bandwidth too much) from 4chan threads? What would you use and how would you do it?
I'm able to do it "somehow", I just don't want to write it like a tard.
I'm thinking of using wget, but I don't know what's the best way of extracting the image links.
>>
>>59712264
Aren't those called methods?
>>
>>59712260
anyone? Does it really matter which way I chose? Just a noob here looking to make efficient habits
>>
>>59707776
gimmie download link ples
>>
>>59711722
evens = (RNG.Next(0, 1) == 1);
Console.WriteLine(evens ? "The coin landed on heads! \neven numbers don't lose lives." : "The coin landed on Tails! \neven numbers lose lives.");


This should chomp down almost that entire section
>>
>>59712292
https://pypi.python.org/pypi/BASC-py4chan/0.6.3

Use this.
Then just use the request lib to download from the list of image links you get.

Or if you are a glutton for punishment, you can write your own wrapper for 4chan API or use Beautiful soup.

But if you are not in for the learning experience, using the 4chan library someone else made is fine.
>>
>>59712304
Calm down: your post was literally 5 minutes ago.
>>
>>59712177
The coin is only flipped once, didn't seem worth it to give it its own function. but high/low is a good idea ty.
>>
>>59712292
Here, I'll save you some time:
#!/bin/bash

curl -s "https://a.4cdn.org/$1/thread/$2.json" | jq -r ".posts[] | select(.tim) | \"-O https://i.4cdn.org/$1/\" + (.tim | tostring) + .ext" | xargs curl

Done bother with the memesnek.
>>
>>59712282
What are the semantic differences between a method and a procedure?
>>
>>59712325
>Done
Don't
>>
>>59712309
// pseudocode
evensS = ["The coin blabla", "Tails w/e"]

evensS[RNG.Next(0,1)]
>>
>>59712238
for c++
They all suck. I tried so hard to find a toolkit that was as easy to use as qt. and eventually gave up and just went with python.

I think a lot of people go with wx widgets though.
>>
>>59712325
well, that was easier than I thought
>>
>>59712332
The coin flip is to determine if even numbers will take away a life or not.
I only need it once.

>>59712309
Thankyou.
>>
>>59712264
return *this;
>>
>>59707887
DESIGNATED
>>
>>59712115
Wouldn't a vector be better
>>
https://github.com/lattera/glibc/blob/master/stdlib/getenv.c#L32

GNU code is the ugliest code I've ever seen
>>
>>59712423
I know. I actually tried to contribute once... Simply walked away once I saw that shitty code.

There are better libc out there
>>
>>59712264
agreed

who /referential transparency/ here?
>>
>>59712423
>#error "Funny byte order."
>>
>>59712423
>
/* The name of the variable consists of only one character.  Therefore
the first two characters of the environment entry are this character
and a '=' character. */


ah yes
>>
>>59712300
methods take an implicit self parameter
>>
>>59712423
>>59712444
It's why I use Windows.
>>
>>59712444
I noticed that getenv is mutable, which is weird. doing
char *a = getenv("HOME"); //home folder is `/home/user`
strcat(a, "test");
printf("%s\n", getenv("HOME"));

will print
/home/usertest


So I figured I'd read the code and see what was up, but it's just garbage
>>
>>59712474
Hello NSA
>>
>>59712413
std::vector<bool> stores each bool in a single bit as a space optimization. That can be advantageous in some cases but most of the time it just makes it more difficult to use (you can't take a reference/pointer to one value, for example)
>>
>>59712474
GNU runs on Windows too though.

If I need to do something, I just issue Linux system calls directly. Linux is actually a LOT better this way. GNU interfaces are gimped in the name of portability. If Linux does something different than some forgotten Unix variant some poor sap still uses, you bet your ass GNU will try and support it.

Kernel guys really need to make a liblinux so we can kill glibc forever.
>>
Does anyone know where to find a compiled binary of YouCompleteMe for windows 64? This thing has the most convoluted building process possible for mingw that doesn't even work unless you make a gorillion barely documented bug fixes.
>>
>>59712313
well this thing happens where my post gets ignored :(
>>
>>59712501
Linus/Linux:
>Genius engineer
>meticulous attention to detail
>strives for perfection
>lets contributors know when they're trying to push shit code

Richard Stallman/GNU:
>Old communist hippy
>His agenda is more important to him than actually coding
>
char *
getenv (name)
const char *name;
{
>>
>>59712521
Install Neocomplete
>>
>>59712537
>Genius engineer
>meticulous attention to detail
>strives for perfection

But
>Codes in C
>Plenty of exploits discovered despite his genius
>>
>>59712566
Two questions:
1. How well does it handle C languages?
2. Can you build and install it on windows without recompiling the universe first?
>>
>>59712537
Did you know that Linux doesn't really have a notion of threads? Everything is a process, and processes are "execution contexts", a bag of registers and other state. It's quite simply everything the kernel needs to resume execution.

With the clone system call, you can fork the process with ridiculously fine grained control over what actually gets shared. For example, if all you wanna do is spawn a new process with execve, then you can do a lightweight clone that includes only the virtual memory pages allocated to the process. No need to share any other kernel resources such as file descriptors. You have a ridiculous amount of control over this; you can choose exactly what you need and Linux will do the right thing.

Of course, shitty C libraries will transform that awesome kernel interface into a piece of shit "thread" abstraction and make all those choices for you as if it knew better.

"Portable" libraries are a mistake. It's better to deeply understand the system you're targeting and then write code that works well with that system. Much better than using some failed abortion of a library that tries to abstract the OS away using some shitty concepts straight out of CS class. At best, you only get the intersection of features supported by all target systems. If it even works properly.

You know what's most ironic here? Guess what platform encourages that sort of mindset... It's Apple.
>>
>>59712304
>Just a noob here looking to make efficient habits
It wouldn't really matter.
If you want >muh performace, why not just save a pointer to the array into your class, then access it from there?
That way you avoid the getting the reference of the class that contains the array.
>>
File: C H E C K E D.png (182KB, 320x240px) Image search: [Google]
C H E C K E D.png
182KB, 320x240px
>>59712655
>if you want >muh performance
>suggests indirect access through pointer
>>
>>59712667
>passing multi-megabyte arrays by value
>no impact on performance
>>
function F(input){
if(input == "What did you said!?"){
console.log("Fuck");
return W("Fuck You!");
}
}
function W(input){
if(input == "Fuck You!"){
console.log("What?");
return F("What did you said!?");
}
}

W("Fuck You!");
>>
>>59712313
A semicolon would be nicer here
>>
Was ML robbed?
>>
Euler 39:

from math import *

res = [[]]*999

longestLength = 0
longest = 0

for p in range(999):
psize = 0
crang = int(p/8)
crangAdj = int(crang/2)
cmean = int(10*p/24)

for ii in range(crang):
c = cmean - crangAdj + ii
for b in range(int(7*p/24), c-1):
a = sqrt(c**2 - b**2)
if a.is_integer() and (p == (a+b+c)):
psize += 1
res[p] = res[p] + [(a,b,c)]

if psize > longestLength:
longest = p
longestLength = psize

print longest
[\code]
>>
Working with HTML+CSS.

Webdev is a nigger-tier job, fuck this.
>>
>>59712715
There's a webdev general, but I guess who gives a shit. It gets marginally better when you start doing programmatic JS in the back to ease the bullshit, and then a hell of a lot worse when your code gets big and you factor in backends. It really is shit.
>>
>>59712743
Literally don't use JS, ever.

Use ClojureScript or PureScript or Elm or whatever, I don't care as long as it's a lot better than JS.
>>
>>59712705
Let me get it out of the way first

>Python
>>
>>59712129
That's rather compact and expressive when considering how many concepts he's putting there.
>>
>>59712753
I don't do webdev anymore, I've denounced it entirely. I don't think I'm capable of writing JS that isn't spaghetti so yeah I really would prefer those if I go for it next time.
>>
>>59712755
Python is banned at my workplace.
>>
>>59712777
Okay now that it is out of the way can you explain this

res = [[]]*999
res[p] = res[p] + [(a,b,c)]


Instead of just declaring an array and appending to the array
>>
>>59712743
I'm a CS studant, this is just to "acquire experience". Hopefully I'll change my area (it's a junior enterprise) soon. Probably I'm going to work with the servers, I'll let this intellectually boring work for some down-syndrome masoquist, good lord.
>>
>>59712800
It's probably faster than appending since it doesn't need to resize the array
>>
File: neo.png (44KB, 796x324px) Image search: [Google]
neo.png
44KB, 796x324px
>>59712613
werks for me
I dont remember anything about the install but I don't think it was hard.
>>
>>59712819
>Faster
>Using python
Lmao. The reason you use python is because of ease of clobbering code together and readability. The last thing you should be worried about is writing python code in any manner that makes it "faster".
>>
>>59712777
My old workspace intends to use python 2 forever because all their shit uses it.
>>
>>59712852
When your work requires you to code in Python I consider it a good. You are still largely a code monkey but I rather code in something that I can auto pilot than something that requires me to constantly refer to a manual.
>>
>>59707863
>(C)
You failed already
>>
>>59712879
Haskell and Idris let you autopilot. Python doesn't. Python doesn't give you any help whatsoever. You have to keep the whole project in your head, because there's no compiler to help you when you screw up.
>>
Working on a simple library for manipulating sql databases in c++. Evemtually I'm going to create wrappers for working with dbs in azure or aws. Just trying create a portfolio as a jr dev on my github.
>>
>>59712829
>uint32_t
>not including stdint.h

this makes me angry
>>
How do I do markov chain?
>>
>>59712916
Haskell and Idris lets you auto pilot but it is actually hard to find jobs where you code in Haskell and Idris and you are allowed to allow pilot.
>>
>>59713018
A damn shame that we instead have farms of Python coders, all because managers would rather have 10 unskilled workers than 1 skilled worker that they might have to give a bit of job security to.
>>
>>59712492
if he wants a byte, he can use char. no need to write that much.
>>
>>59713049
It's funny that Python is a pajeet language by now.

It used to be the language hackers chose for their own personal projects because they like the way the code looks.
>>
>>59713070
> because they like the way the code looks.
>>
>>59708588
you need to check the diagonals as well. you only look up down right and left.
>>
>>59708214
pink is goat, faggot
>>
>>59713070
Any language that has a big job market will be a Pajeet language. A pajeet language isn't determined by the complexity or the difficulty in usage but rather the amount of jobs that uses said code.

>>59713049
We can thank the H1B1 for that. It is vastly cheaper to hire 10 unskilled pajeets than 1 skilled worker.
>>
>>59712537
>char *
>getenv (name)
> const char *name;
>{
what's the problem in here?
>>
>>59713110
That parameter type declaration is extremely archaic. From a time where C wasn't even standardized.

There's nothing wrong with putting the return type on its own line though.
>>
i don't understand the bitwise operation syntax in C

what a fucking mess
>>
>>59713138
Congratulations, you're retarded.
>>
>>59713138
What syntax do you consider good then?
>>
>>59713138
Yes, the operator precedence for the bitwise operators are pretty fucking stupid.
Unfortunately, it's too late to change it now.
>>
>>59713145
of course i'm talking about the low level stuff, not shit like or and and
>>
>>59713138
wait until you get to function pointers.
>>
>>59713133
>parameter type declaration is extremely archaic
I know, but I don't see any problem with that.
I don't get why people even worry about such details.
>>
anon, do you have any favorite sources for qt development besides qt documentation?
>>
>>59713138
wew
>>
>>59713110
it's a fucking waste of vertical space
>>
>>59713176
They don't "fit into" the whole prototype scheme. So basically, you can't forward declare them using that syntax.
Back in the day, the compiler couldn't even check if you were calling a function correctly.
>>
>>59713207
but space is infinitely long, it's not going to run out if you use it.
>>
>>59713207
don't be silly
>>
>>59713176
this, it's such a non issue
>>
Trying to learn Java gui. How would I launch a dialog when a button is clicked. Trying to do an add button that launches a dialog for the user to enter certain info. I know how to create the dialog but not how to get it to launch.
>>
>>59713246
you're a fucking pleb, you're just playing with abstractions
I bet you don't know how gui even works, pleb
>>
>>59713268
great advice
>>
>>59713246
draw it
>>
File: laugh.jpg (77KB, 600x536px) Image search: [Google]
laugh.jpg
77KB, 600x536px
>>59713232

He doesn't print out his code.
>>
>>59712800
You're right - I should've used
res[p] += [(a,b,c)]
. It looks nicer than res[p].append((a,b,c))

There is no speed difference as res[p] is effectively resized.
>>
>>59713246
JOptionPane to show messages
but if you want to create a new panel to put some data, just create another JFrame
>>
why is dear imgui documentation so bad? I couldn't understand shit from it.
at least there are a few tutorials.
>>
>>59713323
You mean res.append((a,b,c)) right?
>>
For my AI class I'm building a basic multilayer perceptron network with backpropagation. I'm really enjoying it, and have been abstracting the neurons rather than hardcoding them like nearly everyone else in my class. Where should I go with this to keep expanding as my own project? I know that there are already dozens of already-useful libraries for NN out there, so working in that direction is probably pointless....right? Or would it be worth trying to make it useful as a personal tool? Any advice? I've never taken on a big project before
>>
What's the best way to render a number as a series of animated bitmaps?

I want to make a software that converts a fibonacci sequence into 2D anime porn.
>>
File: 2017-04-03 01-03-15 VP8 Slow.webm (502KB, 1280x720px) Image search: [Google]
2017-04-03 01-03-15 VP8 Slow.webm
502KB, 1280x720px
>>59707776
Working on a Collatz Conjecture visualizer
>>
>>59713007
https://www.lua.org/pil/10.2.html
>>
How do I get the current time in seconds since epoch in C?
>>
>>59713760
time_t time(time_t *t) from time.h returns a time_t with the second value
>>
>>59712407
>>59707980
haha epiKKK /pol/ meme my epic /utg/ gay anal homo millennial fag SJW nigger nazi kike /b/rothers xD dDDDD xxxDXDXXXDDD
>>
>>59708438
>her
>>
            ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>();
keySchema.add(new KeySchemaElement()
.withAttributeName(partitionKeyName)
.withKeyType(KeyType.HASH)); //Partition key

//set the Attribute defintions for the table
ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>();
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName(partitionKeyName)
.withAttributeType(partitionKeyType));
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName("MPAA_rating")
.withAttributeType("S"));

//add the range
if (sortKeyName != null)
{
keySchema.add(new KeySchemaElement()
.withAttributeName(sortKeyName)
.withKeyType(KeyType.RANGE)); //Sort key
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName(sortKeyName)
.withAttributeType(sortKeyType)
);
}

//local secondary index schema
ArrayList<KeySchemaElement> indexKeySchema = new ArrayList<KeySchemaElement>();
indexKeySchema.add(new KeySchemaElement().withAttributeName("Year").withKeyType(KeyType.HASH)); //Partition key
indexKeySchema.add(new KeySchemaElement().withAttributeName("MPAA_rating").withKeyType(KeyType.RANGE));


What is the easiest way to ensure that my secondary index give me unique values when I query it?
>>
I'm planning on making a software that converts math into porn.

any advice?
>>
>>59712537
That style actually makes sense once you have tons of arguments/long named arguments for a function.
>>59712639
rekt
>>
File: 1489868522355.jpg (73KB, 1280x720px) Image search: [Google]
1489868522355.jpg
73KB, 1280x720px
>>59710603
I tried using VirtualProtectEx to set the memory to PAGE_READWRITE before writing to it, it doesn't fail to do so but but I still get the access violation upon trying to write to the .text section.
These Windows headers are fucking awful.
>>
>>59713937
By math you mean money right?
>>
>>59713974
no, math being represented as animu pixel art porn.

of course I want to make money off it.
>>
>>59713994
Right
>>
http://imgur.com/a/ZrH3X
Is this bad code?
>>
>>59714005
Nope, it's perfect.
>>
>>59714005
Nice job pajeet
>>
>>59714005
>new Triangle( <13 parameters> )
wew lad
>>
>>59713906
Leave this place
>>
File: 1466169725690.jpg (214KB, 600x620px) Image search: [Google]
1466169725690.jpg
214KB, 600x620px
>>59707795
If your language can't trivially solve its own halting problem, it's complete trash.
>>
>>59714080
Fuck off, cuck.
>>
>>59714444
four 4s of truth

turing completeness is a meme, and even if it weren't, computers have finite memory
>>
>>59714688
How can it be a "meme"? I think you mean "useless garbage" here.
>>
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/lecture-6-avl-trees-avl-sort/
pretty good so far. you should give it a shot.
>>
Writing a script in Elixir that adds a random pixel to an image so you can repost it
I'm going to repost the same image a million times
Get ready for the spam
>>
>>59715041
it has greater publicity as a concept than it deserves
>>
>>59715083
Then saying that it has a lot of memes surrounding it would be more appropriate.
>>
>>59715081
I am more interested in how you bypassed the captcha to spam.
>>
>>59715106
>what is jew pass
>>
>>59715106
i am paying 100 indians 5 cents per hour to solve it
>>
>>59715096
no, it is itself a meme, which goes back to the roots of when Dawkins coined the term for similarities between genes and ideas, but flavoured with the new context and connotation of an idea spread above its worth, as opposed to the darwinian lack of a notion of worthiness
>>
>>59715122
"meme" isn't somehow synonymous with what you tried to imply in that post.
>>
>>59715116
>Giving the jew real money so you can waste it by getting banned for spamming
Impressive
>>
>>59715137
are you not aware that the word meme was coined in the 90s or 80s or somewhen, at the time Dawkins wrote The Selfish Gene?
or how it refers to the way both genes and ideas spread in a darwinian fashion? that a gene or idea can be memetic
>>
Move to
>>59707778
>>59707778
>>59707778
>>
>>59715148
I am aware of it, which is exactly why I think your usage of the word is incorrect.
>a gene or idea can be memetic
Something being memetic and something being a meme are two very different things.
>>
>>59715171
meme does not mean image macros and never has

please stop using the modern normalfag urban dictionary version
>>
>>59715187
I'm using the word "meme", which means it can't possibly mean "image macro".
>>
meme macro
>>
>>59715211
>being wrong
i hate this meme
>>
>>59715232
I hate your overuse of the term "meme" and your inability to quote properly.
>>
i hate all memes, image macros, meme macros, and image memes
>>
>>59715245
>i am wrong
realising this is the first step to correction
>>
i want to put my meme on an image
>>
>>59715253
Who is wrong? Nobody said that.
>>
>>59710652
>le insert rust shit everywhere
Or, you can just off yourself :^)
>>
>>59715683
Now now anon, thats not very COC of you~
Please be kind and courteous. There’s no need to be mean or rude.
>>
>>59711602
posting the entire code makes it easier for someone to come along and help you out, that being said

all of your code after giving NextNum a random index can be made into a function

while its not optimal from a reading or code reuse perspective (c# also doesnt fold references) its fine if it works for you, it's all basic math
>>
>>59708146
bite the bullet and use higher order functions ffs
Thread posts: 334
Thread images: 22


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