[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: 314
Thread images: 38

What are you working on?

Old thread: >>58666124
>>
First for C++ is the best language and "Modern" bullshit like java and C# and other meme languages(go, lisp, haskell, javascript, etc) are destined to die
>>
File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
Many thanking you for animated picture
>>
on a virus that will delete all animu from the internet
>>
File: 1470879620151.jpg (54KB, 500x375px) Image search: [Google]
1470879620151.jpg
54KB, 500x375px
>>58673374
you can't delete anime from our hearts
>>
>>58673351

And where am I supposed to search?
>>
data Expr = Var Natural | Abs Expr | App Expr Expr
>>
>>58673368
>Java
>modern
You kek
>>
thinking of writing an arm assembly lexer. Just the lexer. Where should I start? Wheres some reading material on implementing one in something like C++?(as opposed to using one of those generators out there)
>>
>>58673415
Dragon book?
>>
>>58673395
Ok now write eval
>>
I usually reply to this thread or focus in on it, but
>WHY
>THE
>FUCK
are there 3 "Daily Programming Thread"s every day. Hardly any reach bump limit. Theres currently 2 of them within the first 2 pages.
>>
>>58673352
>What are you working on?
php project for uni exam that i've been procrastinating on
unlikely to make it in time but i'll try

>>58673368
seconded
>>
>>58673441
eval = head . dropWhile ((/=) <*> simplify) . iterate simplify 
>>
What languages can you think as used not as indented about?
>>
File: golang.sh-600x600.png (69KB, 600x600px) Image search: [Google]
golang.sh-600x600.png
69KB, 600x600px
How the fuck do I set up a Go workspace with multiple projects in it? I can't seem to run build or install for the life of me.
>>
>>58673426
I hear about this book so much but I also hear people scorning it in this "stop recommending this old-ass book" kind of tone

This book is at my uni library though. The first edition and not the second.
https://www.amazon.com/Engineering-Compiler-Keith-Cooper/dp/155860698X/ref=sr_1_3?s=books&ie=UTF8&qid=1485499275&sr=1-3&keywords=engineering+a+compiler
>>
>>58673463
Well memed
Now write type inference
>>
>>58673497
>>
>>58673453
some fag posted a new thread before the bump limit a couple of threads ago and janitors didn't delete it. just wait for it to die
>>
>>58673479
install go 1.8 and mkdir -p ~/go/{src,bin,pkg}, then put your project folder in ~/go/src/yourproject
>>
>>58673368
this

>C++
https://www.youtube.com/watch?v=rWDNwN0h0LM

>python, etc
https://www.youtube.com/watch?v=rkcXRBhYZHU
>>
>>58673487
Do you download books?
>>
>>58673545
Does it make a difference if it's in the home folder? I have all that shit set up and even set the GOPATH, but all I get is errors.

And just to be clear, you're saying that I should keep all my different projects in the src folder right?
>>
>>58673562
I do but digital books are easier to "shelf" indefinitely than having a physical book to touch and interact with and taking up space. I'll check out the first edition I guess as the library only has the second edition available digitally-only as well
>>
>>58673552
>links to videos
fucking niggers
I'm an intellingente purson, not ill literate, I know, how to reed, give me links to articles
>>
>>58673570
yea they all have to be there(there are other hacky ways), just get over it and keep everything in GOPATH/src/<project>
>>
>>58673552
machines are fun
why did i become a computer scientist?
>>
One thread at a time you autistic faggots.
>>
>>58673647
t. OP of other thread

The other thread should've been deleted ages ago.
>>
30th for ActionScript 3.0
>>
>>58673415
second dragon book

youre writing a finite automaton so the most brute force version would be using while loops and switch statements to change state upon reading a new char, then for each lexeme you want to be writing tokens (defined as an enum for e.g.) to memory for the parsing stage.
>>
>>58673728

Flash is dead, Anon. Use JavaScript for all of your browser applications.
>>
>>58673352
What makes IO asynchronous?
I'm messing around with boost::asio async timers, but not really sure what the difference is between the synchronous timer and asynchronous timer.
http://www.boost.org/doc/libs/1_63_0/doc/html/boost_asio/tutorial.html#boost_asio.tutorial.tuttimer1
Pls explan.
>>
>>58673671
Then finish it autismo
>>
>>58673593
I don't have a problem with the workspace structure.

Now how do I import other files from a main file? I can't seem to get the file path right. They're in the same damn folder... how hard can it be?
>>
>>58673749

Synchronous I/O: Thread is blocked completely on a read.

Asynchronous I/O: Thread continues to execute on a read, handling other requests. When the read is finished, a callback function is executed.
>>
>>58673415
Parser monad
>>
File: deadScriptMyDudes.jpg (79KB, 1057x300px) Image search: [Google]
deadScriptMyDudes.jpg
79KB, 1057x300px
>>58673740
But what if prototypes give me cancer, and i write desktop apps
>implying im not aware the platform died a long time ago
>>
>>58673812

If you're writing desktop applications rather than browser applications, that is twice the reason to not use Flash. You have a hell of a lot better options. Fuck, if you want to use a bytecode language, try C# or Java. If you want decent performance, use C++.

There is not a single valid reason to continue producing Flash applications in 2017.
>>
i became an expert on this one fluffin random software package just by fiddling with it and they went ahead and hired an official "lead programmer" who is completely incompetant so it's gone without release for over a year and no pull requests get merged

open source=meme
>>
>>58673779
fuckin finally I got it working. MAN there are some shitty answers to this shit on google
>>
For mingw64, SJLJ vs SEH? SJLJ allows for 32 bit version generation as well correct? How big of a need is there for 32 bit versions for windows?
>>
guys this might sound crazy but since Ive began studying programming a month ago I have a lot of very vivid dreams each night
>>
>>58673863
>There is not a single valid reason to continue producing Flash applications in 2017.
When Javascript games are easier and faster to program than Flash games.
>>
>>58673863
My main language is C++ ruby-sama, but my school refuses to use anything other than AS3 for the programming course, its shit and a toddler could get an A in the class. Anyway, im quite aware of the limitations, although i must say its quite fun to write in, this being the reason i mentioned it

>tl;dr im a faggot
>>
>>58673789
The async timers still seem to block though when io.run() is called.
>>
>>58673939

MinGW-w64 uses SEH by default (64-bit platforms), and SJLJ when the -m32 option is used (32-bit platforms). As a programmer, you shouldn't really concern yourself too much with which exception model is used, unless you are doing something weird. As for whether 32-bit Windows applications are still relevant... I'd like to think it shouldn't be, but I do see people who still use it, so you might as well compile two binaries.
>>
File: 1484431183728.jpg (83KB, 546x678px) Image search: [Google]
1484431183728.jpg
83KB, 546x678px
I'm trying to make a function that returns the min value in an array that is not less than a specified value.

I need 2 local variables to accomplish this: a MinValue and a ValueFound bool.

Normally if I needed to find the min value in an array, I would just assign MinValue to the first index and wouldn't need the bool

But the problem is there's no guarantee the first value, or any value for that matter is greater than the specified minimum, hence the need for the bool.

Is there a clever way to make this work without the boolean?
>>
>>58673949
If you seriously think JavaScript can be considered anything other than "easy as shit", you need to stop calling yourself a programmer.

>>58673981
Yes, well, that may just be an odd quirk of the Asio library. In typical asynchronous I/O setups, there is no blocking.

>>58673962
Lovely. Your university has decided it is absolutely necessary to impart unto you knowledge that is already obsolete.
>>
>>58674109
Initialize MinValue to the largest possible value.
>>
>>58674109

>minimum value in an array that is not less than a specified value
What does it return if it doesn't find one?
>>
>>58674109
see >>58674133
You're basically looking for a monoidal property - an identity element / a zero.

If you want a well typed system, then you can't guarantee that their is a minimum (empty array) above a certain value (all elements below that), and you'd have to return something like Optional or Maybe.
>>
What does " free(): invalid next size (normal): 0x00000000025d2e50 " errors generally mean?
>>
>>58674109
Maki poster was rare lately.
>>
File: 1483998399141.jpg (111KB, 1024x768px) Image search: [Google]
1483998399141.jpg
111KB, 1024x768px
>>58674158
/g/ loves maki
>>
File: FnVizualizer.jpg (13KB, 184x158px) Image search: [Google]
FnVizualizer.jpg
13KB, 184x158px
>>58674146
I see your point. What I'm actually trying to do is calculate the closest value to a specified value in an array, with a boolean to decide on a tie (I.E. specified value is 5 and both 4 and 6 exist in the array). The min thing was only part of my solution.
>>
>>58674048
So when I install it just go with SEH?
>>
>>58674169
maki is /g/'s favorite slut
>>
>>58674183
graphical coding was a mistake
>>
File: 1474733749124.jpg (81KB, 1280x720px) Image search: [Google]
1474733749124.jpg
81KB, 1280x720px
>>58674213
>>
File: 1480536678982.gif (197KB, 500x285px) Image search: [Google]
1480536678982.gif
197KB, 500x285px
>>58674218
I knew I was going to get shit for posting that
>>
>>58674169
Not really

>>58674213
More really
>>
>>58674183
What is this that you are using?
>>
>>58674247
do you feel like you can relate to her anon? like her love for cocks and femininity?
>>
>>58674237
that's ue4 right? the problem with graphical programming is that it enables shitters to "code" and use those blocks (which are black boxes for them) without any understanding.
>>
>>58674275
Graphical programming is superior
>>
>>58674271
I fail to relate even to anime girls
>>
Something like this (pseudocode)?

/* Distance between two values */
function distance(a, b):
return abs(a - b)

/* Return closest element in array to value
* Boolean argument uselower tells if we should prefer the lesser of two values
*/
function closest(array, value, uselower):
x = first element of array
for y in rest of array:
dy = distance(y, value)
dx = distance(x, value)

if (dy < dx):
x = y
else if ((dy == dx) and (y < x) and uselower):
x = y

return x
>>
>>58674268
UE4/c++

>>58674275
I don't disagree but if you actually are experienced I find it's much easier to debug and harder to make logic errors.
>>
>>58674294
Are you making a game or what?
>>
Kind of a stupid question but I couldn't find out information about this anywhere so here goes:
Suppose I have a Python script that spits some output, and I want to use that output as a (((command line argument))) for a program. How would I go about that (on Unix)?

I tried
./program python3 -c 'print("something")'
but that clearly doesn't work and argv[1] becomes "python3" instead of "something" which is what I was intending.
>>
File: 1434229519851.png (210KB, 871x900px) Image search: [Google]
1434229519851.png
210KB, 871x900px
>>58674109
Naive implementation (for a naive problem):
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int find_bounded_min(int array[], int length, int lower_bound)
{
int key = INT_MAX;
for (int i = 0; i < length; ++i)
if (array[i] < key && array[i] >= lower_bound)
key = array[i];

return key;
}

int main(void)
{
int array[] = {100, 4, 33, 21, 0}, lower_bound = 6, rv;
rv = find_bounded_min(array, sizeof(array) / sizeof(int), lower_bound);
printf("%d\n", rv);
return EXIT_SUCCESS;
}
>>
>>58674322
./program $(python3 -c 'print("like this")')
>>
>>58674349
That or
./program `python3 -c 'print("something")'`
>>
>>58674109
if you keep the array sorted you just have to return the first element that's above the threshold
>>
>>58674349
>>58674389
Many thanks, this works. Sorry for the stupid question.
>>
>>58674400
sorting is more expensive than just iterating it
>>
>try to get PHP working in NetBeans
>gives you numerous options for everything, some of which are undocumented
>get stuck at "Composer must be selected", and the only thing I can find on "Composer must be selected" online is an unanswered stackoverflow question
Why do programmers love modular stuff so much?
>gee I'm glad I spent hours on configuration to save 2 seconds on my compile times
>>
File: 1484404510999.jpg (174KB, 1617x742px) Image search: [Google]
1484404510999.jpg
174KB, 1617x742px
>>58674292
This helped make it work. In your psuedo in the else-if it needed to be
else if ((dy == dx) and (y < x) == uselower):


>>58674320
Yes
>>
I just got back from an interview and one of the given problem is:
I have 2 large files (TBs) with sorted strings (line delimited)
How to combine the 2 large files and only keep unique strings?
Requirements/Assumptions:
-Can only use standard API
-Can't use external database solutions
-The contents of the files are already sorted, though not necessarily distinct

I answered by reading all lines from the 2 files, transfering them to an output file, but making sure to only write unique strings (via binary search check)
The interviewer told me that I can do it in linear time. What did he mean by this?
>>
>>58674426
it's really cheap if it's almost sorted (which is usually the case in games) and the sort can be useful for other things as well
>>
>>58674516
In the same way you do the "merge" step from merge sort.
>>
>>58674516
Make two variables representing the current indices of both files. Have a while loop compare the string at each index. If one is less than the other, write that one to the output file and advance that index. If they are the same, write either of the two strings and advance both indices.

While loop ends when either index has reached its max. Then you just loop through the remaining file.

This assumes there are no duplicates within each individual file.
>>
>>58674526
really depends on the use case. if you need to find more than one value sorting might worth it, sure
>>
>>58674568
>This assumes there are no duplicates within each individual file.
>-The contents of the files are already sorted, though not necessarily distinct
>>
>>58674526
>it's really cheap if it's almost sorted (which is usually the case in games)
Good guess. It actually is sorted and that's what I ended up doing.

>>58674585
Fug you got me. If the strings were the same you would need a nested while loop to advance both indices until they reached a new string
>>
>>58666578
>malloc can fail
when is this ever a real concern in normal programs?
>>
>>58674483
Also, how am I supposed to solve the "Composer must be selected" issue?
As far as I can tell, there are no composer related options in Netbeans.
>>
>>58674196

That should be how it works if you're getting an up to date version of mingw-w64. Target triple should be x86_64-w64-mingw32 or x86_64-pc-mingw32, I think.
>>
>>58674643
modularity isn't about compile times you dumb nigger
>>
>>58674640
When Windows Update starts, eats all your memory again, the system starts swapping and at some point Windows refuses to allocate memory for you.
>>
>>58673476
pumbing
>>
>>58674516
See: >>58674567

Pseudocode (C/Python-like because it's hard to be language agnostic), O(n) solution:
declare integers (i1, i2, i3) = (0, 0, 0)
while stringfile1[i1] != EOF and stringfile2[i2] != EOF:
if stringfile1[i1] < stringfile2[i2]:
if i3 > 0 and stringfile1[i1] == stringfile3[i3 - 1]:
i1++
else:
stringfile3[i3++] <-- stringfile1[i1++]
else:
if i3 > 0 and stringfile2[i2] == stringfile3[i3 - 1]:
i2++
else:
stringfile3[i3++] <-- stringfile2[i2++]

if stringfile1[i1] == EOF:
while stringfile2[i2] != EOF:
if i3 > 0 and stringfile2[i2] == stringfile3[i3 - 1]:
i2++
else:
stringfile3[i3++] <-- stringfile2[i2++]
else:
while stringfile1[i1] != EOF:
if i3 > 0 and stringfile1[i1] == stringfile3[i3 - 1]:
i1++
else:
stringfile3[i3++] <-- stringfile1[i1++]
>>
>/dpt/ - Daily Pseudocode Thread
>>
>>58674765
No one wants to do your homework.
>>
how fast is a bitshift?
>>
>>58674772
I don't study.
>>
>>58674781
I can tell.
>>
>>58674643
I see the problem.
There is supposed to be an option for choosing the composer, but I don't have it despite having the latest version of Netbeans.
What the fuck, Netbeans?
>>
>>58674773
Depends on architecture, on AVR platforms it's one cycle per position.
>>
does unrolling a loop actually improve performance?
>>
>>58674797
So?
>>
what license should I pick to "avoid" free commercial usage? for example, let the software free for students and other open source projects but not free for a bank that want to make money with the software?
>>
To get a job do do learn python, java, or c# first?
>>
>>58674816
>the software free for students and other open source projects
You're a big guy.
>>
>>58674816
creative commons
>>
>>58674829
Out of those three, Java.
Assuming of course you have no other programming background.
>>
>>58674862
>Assuming of course you have no other programming background

or self respect
>>
File: 1484334193780.jpg (17KB, 256x352px) Image search: [Google]
1484334193780.jpg
17KB, 256x352px
>>58674876
agreed, Java sucks
>>
>>58674829
If you want a job, learn web dev. That means javascript / node.js / react
>>
>>58674876
Java is shit but it's a good first language because it teaches your what you need to know about OOP, and if you do learn it, it's not hard to get employed.
>>
When people say that there's a PHP interpreter in usr/bin, what directory are they talking about?
>>
>>58674808

>one cycle per position
Wut.

>>58674816

GPL. It technically allows commercial usage, but they have to release source upon request by anyone the application is distributed to. You can offer companies the option of a more permissive license for a fee.

>>58674907

They are referring to the /usr/bin directory, of course.
>>
is unrolling a loop for bitflag testing like this an optimisation or will I only end up on a g meme with this?

http://pastebin.com/cC1XDMak
>>
If I want to create a cross-platform GUI app, what's my best bet in terms of language/library?

IIRC if I want to use C++ I have to choose between wx, GTK, or Qt. They all seem like shit compared to WPF. And I don't want to use Mono.

Is Python good for this?
>>
Write a recursive function that gets the highest value of an array of integers without using the math.max function.

    public static int findMax(int[] a, int p, int r, int maxIndex) {
if (p == maxIndex) {
return a[r];
}
else if(a[p] > a[r]) {
return findMax(a, 0, r + 1, maxIndex);
}
else {
return findMax(a, p + 1, r, maxIndex);
}
}


If the size is 4 and the integers are 5, 1, 2, 100 respectively, it returns 5 not 100.
>>
>>58674961
python is good for nothing
>>
>>58674961
Use Common Lisp+Roswell (for deployments) + McCLIM (native) or any bindings to popular GUI libs
>>
>>58674947

To be honest, you're not going to be getting much of anything out of a loop unroll like that, especially not if the function is not called heavily.
>>
>>58674966
What the fuck is p and r?
>>
In fact, I just realized that code snippet was in Java. Fucking... let the JIT optimize that shit for you.
>>
>>58674992
I didn't include the entire code whoops.

public static void main(String[] args) throws NullPointerException{
System.out.print("Enter the size of the set (Max: 10): ");
int num = input.nextInt();
if (num <= 10 && num > 0) {
int[] intArray = new int[num];
System.out.println("Enter the numbers: ");
for (int i = 0; i < intArray.length; i++) {
System.out.print("( "+ (i + 1) + " ): ");
intArray[i] = input.nextInt();
}
System.out.print("The highest number of this set is: " + findMax(intArray, 0, 0, num-1));
}
else {
System.out.print("Error: The size should be between 1 to 10");
}
}

public static int findMax(int[] a, int p, int r, int maxIndex) {
if (p == maxIndex) {
return a[r];
}
else if(a[p] > a[r]) {
return findMax(a, 0, r + 1, maxIndex);
}
else {
return findMax(a, p + 1, r, maxIndex);
}
}
}
>>
>>58674915
>can't help but reply to a post about a topic you know nothing about
>also give a useless reply to a question so that the question looks answered to people who judge question status by it having replies (everyone), guaranteeing that it won't be answered
As expected of a tripfag

Is there a 4chan plugin or filter configuration that will let me filter all namefag and tripfag posts?
100% of namefag and tripfag posts are bad in my experience.
>>
>>58674984
well define heavily. I guess it will be called between 500-1000 times a second. depending on the performance.
>>
>>58674980
Name one GUI lib that doesn't suck.
>>
>>58675013

>also give a useless reply to a question so that the question looks answered to people who judge question status by it having replies (everyone), guaranteeing that it won't be answered

I answered two questions. Which answer was useless, and why do you believe it is useless?

>>58675016

Not reason enough to loop unroll, especially in Java.
>>
>>58675005
Change if (p == maxIndex) to if (p == maxIndex+1).
>>
>>58675126
And additionally, trash your code and start anew because even though it'll work, it's garbage.
>>
>>58675115
>When people say that there's a PHP interpreter in usr/bin, what directory are they talking about?
>They are referring to the /usr/bin directory, of course.

Are you trying to say that wasn't deliberate shitposting?
>>
>>58675115
Especially since the hotspot compiler undoes most of the optimizations so it has better metrics to perform it's own optimizations.
>>
>>58675137
He's right, though. The PHP interpreter should be in the /usr/bin directory. Not in any subdirectory, just thrown in there.
>>
>>58675137

It is a direct answer to their question. They asked what directory usr/bin was. The proper full directory is named /usr/bin. It is not a relative path, but an absolute path. The usr/ directory is a directory underneath the root of the filesystem ("/") for storing application data intended to be shared among multiple users, and underneath that, bin/ is a directory for storing the application binaries themselves.

The question itself, however, is so dumb that it might be considered shitposting in and of itself.
>>
>>58674966
pseudocode:

num highestInArr(array, currentIndex, currentHighest, maxIndex) {
num nowHighest = (array[currentIndex] > currentHighest)? array[currentIndex:currentHighest;
if(index+1 >= maxIndex) {
return nowHighest;
}
else {
return higestInArr(array, currentIndex+1, nowHighest, maxIndex);
}
}

But that is a pain to set up, so also do:
num highest(array, maxIndex) {
return highestInArr(array, 1, array[0], maxIndex);
}


And that's assuming you can't ask the array for it's length.

In CL and Scheme you can make highestInArr a function local to highest, so other functions can't call it.
>>
>>58674961
Tk is pretty decent these days. Easy to use too.
WPF is utter shit for cross platform, since it isn't cross platform.
>>
>>58675179
I looked stuff up and it's apparently that's a Linux thing.
You assumed that because someone couldn't find the usr/bin folder which only exists on a relatively unpopular group of operating systems, that they were unaware of the fundamentals of their operating system rather than that they might be using a much more common operating system?

Occam is perfectly willing to lend you his razor, there is no need to be selfless.
>>
>>58675263
> PHP on a server

Linux is the most popular server for this purpose. Windows is not.

Please stop being retarded.
>>
>>58675263
>"I looked up stuff and it's apparently that's a Linux thing."
>doesn't know shit about what's being asked
>tries to correct someone else anyway
Way go to, famalam.

>the rest of the post
STFU, you're embarrassing yourself.
>>
>>58675288
>programming on your server
>>
>>58675263

>that's a Linux thing
No, anon, it's a Unix thing. It's /usr/bin/php on Mac OS X, on BSDs, on Linux, and on all of the niche *nixes.

>relatively unpopular group of operating systems
It's relatively popular for everyone using PHP for anything.

>>58675300

If your development/testing environment are too different from your production server, there is a possibility for an entirely different class of problems.
>>
>>58675300
>>58675370
You should make an image of any production server and develop on that one, anyway.
>>
pseudo make me a sammich
>>
>>58673368
>Lisp
>59 year old language that influenced every widely used language today is going to die
kek
>>
>>58674966
>recursive
"No"
>>
>>58675210
Pretty sure the anon you're responding to is aware of that, and is lamenting the fact that the available cross-platform GUI frameworks aren't as good as WPF.
>>
File: 1485398946790.jpg (13KB, 600x159px) Image search: [Google]
1485398946790.jpg
13KB, 600x159px
>>58674116
>If you seriously think JavaScript can be considered anything other than "easy as shit", you need to stop calling yourself a programmer.
JavaScript really isn't "easy as shit". It is "shit", though.
>>
>>58676182
Hmm

I need to check some code.
>>
>>58676182
He also didn't mention how he would encode textures, graphics, ... into the .js file so that it is portble without having to lug a ton of files around/having to unpack it from an archive.
Must be trivial, according to him.
>>
>>58676182
This actually makes sense if I'm reading this correctly.

The behavior is similar in other languages if you map a set of single elements to a function that takes two parameters.
>>
File: anal beads.png (20KB, 1079x353px) Image search: [Google]
anal beads.png
20KB, 1079x353px
>>58676182
>>58676268
To Illustrate, in C#
.Select()
gives you the ability to not only pass "element =>" into the expression, but rather "(element, index) => ", thus the behavior in pic related.

I imagine Javascript is similar in this respect.

For example,
new[] { 5, 15, 69, 10 }.Select(MyFunction)

is equivalent to
new[] { 5, 15, 69, 10 }.Select((x, i) => MyFunction(x, i))
>>
File: anal beads.png (8KB, 195x373px) Image search: [Google]
anal beads.png
8KB, 195x373px
>>58676315
To confirm, I ran these through a javascript console and got pic related.
>>
>>58673352
I want a fairly cross platform way of making mini games. Ive been using opengl for making my own engines and small games, but my laptop doesnt support current opengl which is the time Id mostly want to play these games.
Ive been considering java without any opengl stuff. Just the gui maker for this. How feasible would that be. Im talking 2d games like tetris. Sprites only, no 3d models.
>>
File: anal beads.png (20KB, 599x385px) Image search: [Google]
anal beads.png
20KB, 599x385px
>>58676315
Here's the kicker; the reason why this is even an issue on the Javascript side of things is because
parseInt
in Javascript can take one or two arguments.

In this respect, Javascript defaults to using the most possible arguments, I suppose, whereas a sane language would complain about the potential ambiguity between the two calls.

Pic related; when two definitions of a function could be candidates for the
Select()
expression, the program does not compile. This is how it should be.
>>
I'm reading a book on J.
What would this.knowledge be useful for?
>>
>>58676410
Pretty sure you would be better off with R as far as data science goes.
>>
>>58676355
Unity is actually really good for making straight 2D sprite games.
>>
>>58676434
>straight 2D sprite games
You may as program that shit yourself. That shit in general is pretty easy.
>>
Friends, tell me all about static site generators that can make nice, minimal/simple pages from markdown.

It should support generating hyperlinks to other processed markdown documents, and it should ideally not have a bunch of asinine dependencies so I can run it easily on centos 7.
>>
>>58676449
>>>/g/wdg
>>
>>58675669
*sudo
>>
>>58676398
Very true. If you're interested, there's someone defending this behaviour in the other /dpt/.
>>
>>58676268
>>58676315
FP tards btfo!

>>58676398
won't even compile! how can FP tards even recover
>>
Does anyone know of a program to make my computer app?
>>
>>58676550
Are you at least 18 years old?

What are you even trying to say here?
>>
File: 73637548982174.png (157KB, 552x560px) Image search: [Google]
73637548982174.png
157KB, 552x560px
>>58676550
>>
>>58676538
I am so angry right now 10/10 would rage again
>>
>>58676444
this

unity is really overrated by noprogramming babbies. unity devs tend to avoid the built in unity features anyway

>>58676355
have you gotten the latest drivers? maybe you can't use opengl 4.x but 3.x should be fine
>>
>>58676538
How in the world does this "btfo" anyone?

It's merely informational, and points out a quirk on how Javascript handles these things. Whether or not it is "wrong" is debatable, but I personally prefer more explicitness to be required when ambiguity is possible.
>>
>>58676602
See >>58676582

He's just fishing.
>>
>>58675846
Correct.

I think I'm just gonna go with wxWidgets. Basically just a wrapper over native gui libs. Not ideal but I can't find a better solution.

>>58674980
McCLIM is Linux only and I've never used Common List before. It might be fun to try and learn but I can't find anything decent for it besides Tk bindings that haven't been updated in almost a decade.
>>
>>58674980
Seconding Roswell.
>>
>>58676594
Its an older laptop from 2011. It supports up to 3.0. Id need 3.3 at least. It had a dedicated gpu but the gpu has been dead for over a year. I might try to reflow it but Im not betting on it working.
>>
>>58676561
I meant like I know how to code in C++ and a little of javascript but how to I put the code together with the visual part of a program or an app, like an interface for a computer program/app and stuff
>I will be 19 years old in June
>>
Is there a way to add a Cygwin script to startup(win7)? I need to have it start in a specific user folder as well.

I thought this was more /dpt/ than /sqg/
>>
>>58676651
You need a GUI library. Try wxWidgets.
>>
>>58676672
Put a batch file in
C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
that calls the script in its proper location.
>>
>>58676672
Weak bait.
>>
>>58673374
Post github, I would like to contribute.
>>
>>58676675
Thanks m8
>>
>>58676651
>>58676675
Also look into something like wxGlade or wxFormBuilder if you're looking for an actual designer.
>>
>>58676707
No worries. Happy hacking.
>>
Can anyone post the /g/ Programming Challenges chart (the updated one)?
I saw it in a thread maybe yesterday but I'm dumb and forgot to save it.
>>
>>58676776
>I saw it in a thread maybe yesterday
If only there were some kind of archive of previous threads.
>>
File: Screenshot_2017-01-27_09-34-32.png (17KB, 616x88px) Image search: [Google]
Screenshot_2017-01-27_09-34-32.png
17KB, 616x88px
>wondering why stack instructions don't work properly
>accidentally fucked up stack semantics when redesigning stack
> every stack instruction now decrements the stack pointer
> even when popping
> wondering why example code fails horribly
>see this
>>
>>58676887
Jesus fuck, I'm so glad I don't write C++.
>>
>>58676807
Well jeez, no need to be a dick about it. I don't remember which thread nor which post was it. I looked through so many threads this week that it would be impossible for me to find it at this point.
>>
>>58676899
>it would be impossible for me to find it at this point.
If only there were some sort of search engine that could find images based on text queries.
>>
I was writing a program in C to do this:
-Download a dozen hosts files from the internet
-Normalize everything in 127.0.0.1 or 0.0.0.0
-Remove duplicates
-Output to /etc/hosts

But I got bored along the way and just want to use something that works now.

Do you have any suggestions?
I know there are lots options for this.
>>
>>58676979
>But I got bored along the way and just want to use something that works now.
Use Python. It'll take five minutes.
>>
>>58676992
I was thinking about shell really.
Python would be good too.

Do you have lists of hosts to share?
>>
File: 65024916986564.jpg (15KB, 480x480px) Image search: [Google]
65024916986564.jpg
15KB, 480x480px
>>58676992
>Python
>>
>>58673552
/g/ is truly autistic huh

mans are using sand videos for metaphors
>>
>>58676979

https://github.com/StevenBlack/hosts
>>
>>58676979
>Do you have any suggestions?
Literally any modern high-level language would make this a trivial task.
>>
>>58676965
Alright, you win. Turns out DuckDuckGo wasn't returning many results but I could find it on Google. 3 points for the botnet.
>>
>>58677015
If you're homophobic and associate Python with homosexuality, you could use Perl or Ruby.

Also see >>58677045
>>
>>58674567
>>58674730
Yeah, right. For some reason back then I missed the given that the files are already sorted. Maybe because it's a skype video call and not a pen-paper challenge.
I think I have a shot though. They asked what the other company offered me and might probably counter that next weekday.
>>
>>58677170
god dang biggits ruining our parties and eating our children
>>
>>58676898
this is c with c++ i/o
>>
>>58677225
Even if you're worried about the bigots eating your children, this shouldn't affect your choice of language.
>>
>>58677237
Nasty.
>>
File: Screenshot_2017-01-27_10-07-57.png (4KB, 297x20px) Image search: [Google]
Screenshot_2017-01-27_10-07-57.png
4KB, 297x20px
Someone come up with a list of 256 practical colors.
>>
>>58677254
menstruation red
piss yellow
cum white
shit brown
islam green
>>
>>58673368
>C++
>best language
Enjoy your Turing-complete templates
>>
>>58677170
>Perl or Ruby
even gayer
>>
>>58677254
pepe green/blue/red
pepe rage red
>>
>>58677389
If you're homophobic and associate Python, Ruby and Perl with homosexuality, you could use any other modern, high-level language.
>>
>>58677414
and the pepe colors tinted with pepe rage red
>>
what kind of language should I use as an anarchist monarchist?
>>
>>58677254
Scrotum Beige
Scrotum Maroon
Scrotum Blue
Scrotum White

Obviously, this depends on the state of said scrotum, but there are a myriad of colors to be found there.
>>
>>58677437
The Queen's English.
>>
>58677437
>anarchist monarchist
>>
I use vim+syntastic, and for some reason syntastic doesn't appear to be showing warnings, only errors, when using C#, with mcs as the checker.

When I compile with mcs it shows all the errors, but with other languages syntastic will show the same as the compiler, if i'm using the compiler as the checker.

I heard omnisharp might add better linting etc, but I don't want all the autocomplete bloat with that.

Anyone know how to either get syntastic to report warnings or configure ominsharp just as a linter?
>>
>>58677538
consider switching to emacs+evil and flycheck
>>
>>58677548
I only do a little bit of c# for uni, so I'd rather not completely switch editors desu, it works perfectly for all my other language needs
>>
>>58677538
>>58677561
Well, sometimes different tools work really well with specific techs.

Honestly, it would be a simple thing to use VSCode with Vim keybinds for your C# classes.

I've never really dicked with omnisharp other that just using it as-is. You say "autocomplete bloat", but IntelliSense is very useful in my opinion.
>>
>>58677586
I've never seen the point of autocomplete. Do people here use/like it?
>>
>>58677599
This wouldn't even be a question if you've worked on something non-trivial.
>>
>>58677651
I imagine you're referring to it being used to complete symbols that you're not aware of.

That's one of the two use cases I can see, the second being "I'm too lazy to type it myself".

Is this what people use it for?
>>
>>58677586
I do have VSVim set up in visual studio on my VM, so might just use that. I'm not a big fan of autocomplete, but I guess it does help in a language like C#
>>
I got a job in a window-only shop. I'm going to try to mitigate this by installing linux for windows and see if I can get vim as well, but help me god.
>>
>>58677721
>type function name
>get presented with a small window that shows the definition of the function
>can use the up/down arrow keys to see all of the overloads for said function

That's only one of many things it's good for. It gives you insight into libraries that you're not intimately familiar with, and the combination of the triple-whack documentation appearing in the IntelliSense window gives you what you need to use pretty much anything without doing much research.
>>
>>58677792
>>get presented with a small window that shows the definition of the function
>>can use the up/down arrow keys to see all of the overloads for said function
Oh, I see. So 'autocomplete' is a misnomer.
>>
Trying to hack an asp.net to download a file. Seems to be easy but I've made several attempts with no success. I appreciate any helpIts this app www.shape3d.com where people post their board/boat designs ( http://www.shape3d.com/Warehouse/Default.aspx ) . Some of them are downloadable others no. I just want to make everithing downloadable.
Example:
Downloadable: http://www.shape3d.com/Warehouse/Board.aspx?Board=3341
Non-downloadable: http://www.shape3d.com/Warehouse/Board.aspx?Board=2548
>>
>>58664068
thanks for the input anon, gonna check out those resources and start some Ada projects
>>
>>58677816
Yes, that's why it's a little silly when people say IntelliSense is "just autocomplete".

It does all sorts of crazy bullshit that makes your life 10x easier when programming.

New VS2017 feature allows you to drop your dot operator on the end of a variable and then use a hotkey to filter by all properties/extension methods/etc. that are applicable.
>>
what's your opinion on pair programming?
>>
>>58673415
>thinking of writing an arm assembly lexer. Just the lexer. Where should I start? Wheres some reading material on implementing one in something like C++?(as opposed to using one of those generators out there)

You could try Language Implementation Patterns by Terrence Parr. He goes over basics of making leaders, parsers, ASTs, etc. by hand writing and with his lexer generating tools. Note the book examples are in Java, but I'm guessing that it's easy to translate into C++ if you know both well enough.
>>
Where's that /g/ programming exercise generator thing
>>
>>58677880
It's literally been posted in this thread, you dumb faggot.
>>
>>58677880
>>58677997
Disregard that, I suck cocks. It was posted in the other thread.

http://better-dpt-roll.github.io/
>>
>>58678004
>http://better-dpt-roll.github.io/
I got a scientific calculator. I will do it in BASIC!
>>
>>58676398
>whereas a sane language would complain about the potential ambiguity between the two calls.
So, only statically typed languages are sane?
>>
>>58678132
Is this a rhetorical question?
>>
>>58678293
Is it?
>>
Is there any videos that can explain for loops visually? My friend is having an extremely tough time with loops and I've tried really hard to explain them and how they work. They are always confused when given a problem that involves looking over a set of data.
>>
>>58679201
https://www.google.co.uk/images?q=for+loop+flowchart
>>
>>58679201
just draw a diagram in paint
>>
>>58679201
I don't envy you.
>>
>>58679213
This doesn't help explain instanced variables, and on what type of data you use a for loop on.

>>58679223
I think I'm going to have to do this.
>>
>>58679280
is this a c or python style for loop?
>>
>>58679311
Python.
>>
>>58679201
Tell him that maybe computer science isn't for him, maybe he should consider carpeting or bakery instead?
>>
>>58679324
Why would you teach someone Python?
>>
>>58679328
They're taking statistics and this is their second to last quarter before graduating with a bachelor's and then heading to graduate school.
>>
>>58679343
Because the class they're taking is in Python.
>>
>>58679353
that sucks
>>
>>58679201
i recommend ritalin or dexedrine. your friend gets adhd when looking at data.
>>
File: for loops.png (35KB, 640x400px) Image search: [Google]
for loops.png
35KB, 640x400px
>>58679324
try this
>>
File: 1482425804508.jpg (92KB, 358x429px) Image search: [Google]
1482425804508.jpg
92KB, 358x429px
>>58679454
>object
>>
>>58679485
it's python, what else would it be?
>>
Talked to a researcher in my school's science department about me helping him with some programming applications. They've got 20 years of data in the form of excel spreadsheets, and they need help converting it to an actual database system. However, they're apprehensive about which RDBMS because they want their data to be accessible to the rest of the scientific community, and there's no standards on how this data is stored. I suggested the following:

1.) Choose a popular system like MySQL. This gives good compatibility with other systems

2.) Serve the data in a popular markup format via a webserver, like JSON or XML, so that even if your database isn't compatible with another University's database, they can get the data through your webserver and write scripts to push it to their database.

Does this sound like an adequate solution to the problem of standardization? What are some things to keep in mind when trying to make your data as flexible as possible?
>>
>>58679535
they seem reasonable enough
>>
>>58679535
you're assuming that scientists are competent enough to make a http request.
>>
Do any guys really know APL?
>>
>>58677254
>new

Disgusting.
>>
>>58679535
yes, it does.

do you need help on this?
>>
>>58679535
If the data makes sense in a relational format, get it into something like MySQL, and you can expose a JSON-based API for it later if you want, too.
>>
kek, that other thread stuck around for a day and a half.
>>
>>58674809
sure
but perhaps your compiler already does it for you
>>
>>58680085
because of anime autism. well done lads
>>
>>58680043
>>58679981
>>58679644
>>58679569

This is what I sent him. Pic related
>>
>>58680300
>MySQL is the most commonly used SQL DB
Maybe around free DB, is it true?
>>
File: okay.png (159KB, 1196x902px) Image search: [Google]
okay.png
159KB, 1196x902px
still going for project euler. We did the next one
>>
File: 1482600394171.jpg (239KB, 1280x720px) Image search: [Google]
1482600394171.jpg
239KB, 1280x720px
>>58680194
Why are you even here?
>>
>>58680375
silly way of doing it anon
>>
>>58680346
You're right; I looked it up and Oracle/SQL Server are more common, but as far as non proprietary goes, MySQL is the most popular
>>
>>58680392
Why?
>>
>>58677868
it's kinky when your partner is a cute girl ~ :3
>>
>>58680441
inefficient
>>
>>58680464
that's obv, because of O(n^2).
How would you have done it? Haven't looked into the solution yet. Will do it now
>>
>>58680375
>diff = ... -97
>if 0 <= diff <= 26
You could compare to actual ASCII values as well.
Can Python convert single chars into number values besides ord()?
>>
>>58680507
>Can Python convert single chars into number values besides ord()?
I don't know. Was the first thing I found yesterday.
I know that in C you can just to calculations with chars, without any need of another function
>>
Open source projects you guys are working on?
>>
>>58680559
GNU PLUS LINUX
>>
>>58680559
BasicTV (decentralized TV), and some anon just sent me his RISC architecture i'm looking at a bit
>>
>>58680475

1 to 20 = k letters
101 to 120 = 20(letters in one hundred) + 1 to 20
etc
>>
File: dum.png (2KB, 426x67px) Image search: [Google]
dum.png
2KB, 426x67px
>>58680531
that's not even funny
>>
>>58680613
Looks correct to me.
>>
>>58680592
wew. Sounds not too bad. thanks, maybe I'll try that, but not now.
>>
>>58680613
:-)

But python is really great for big numbers n shit. You can just do
num = 2^1000 and don't need to fuckin care about anything. No overflow. nothing.
>>
>>58680656
>python has unbounded ints
we're all very impressed

how about unbounded rationals?
>>
>>58680656
Yeah, but you can do that in Lisp too.
Only lisp will be faster.
>>
Meh. Tryin to get my head around this one.
How do I get guaranteed the biggest sum? Do I 'just' have to check which number is the bigger one? That would be too fuckin easy and I don't really think this werks, since that shit ain't sorted either

>>58680670
I am not sure. Still a huge fuckin pleb in python.
>>
>>58680381
why the fuck did you post that stupid picture? do you think its funny? it's not
>>
>>58680698
forgot picture. pic related.

>>58680678
Never used lisp. Need to dive into it someday.
>>
>>58680678
But no one knows Lisp
>>
File: unbounded rational.png (10KB, 659x149px) Image search: [Google]
unbounded rational.png
10KB, 659x149px
>>58680698
>>
>>58680711
This is just pathfinding on a very simple graph.
>>
File: 517.jpg (9KB, 248x233px) Image search: [Google]
517.jpg
9KB, 248x233px
>>58680707
Don't whine then.
>>
File: ok.png (20KB, 652x116px) Image search: [Google]
ok.png
20KB, 652x116px
>>58680720
>>
File: 1427054235100.jpg (849KB, 1159x1608px) Image search: [Google]
1427054235100.jpg
849KB, 1159x1608px
>>58673352
As a general rule in C++ should classes go in the header file?
If so, what are the exceptions to this rule?
>>
>>58680746
If a declaration (or template definition) needs to be used in more than one translation unit, it goes in a header.
>>
File: bounded floating point.png (2KB, 255x49px) Image search: [Google]
bounded floating point.png
2KB, 255x49px
>>58680745
>bounded
>loss of precision
guess python doesn't make big numbers easy :^)
>>
>>58680734
Oh fuck me. This is embarassing. Just had that one last semester, kek.
About time to rethink about it.

We spaced repetetition now, r-r-rite? :^)
>>
>>58680745
>GCC 5.4.0
This is why we use debian u n s t a b l e.
>>
>>58680711
Take the 9 Lisp primitives:
atom
car
cdr
cond
cons
eq
label
lambda
quote

If you can understand these, you can implement the original Lisp.
>>
>>58680711
Create a graph (unordered binary graph) and recursively traverse each node and its greatest-numbered child starting at the root
>>
>>58680759
The trick is that instead of finding a minimal cost path you are finding a maximal cost path. Each node only has two edges away from it (or it's at the bottom), so it's quite easy to do. DFS should do nicely.
>>
>>58680771
>the original Lisp
How about unoriginal ones?
>>
>>58680787
Wrong.
>>
>>58680771
>9 primitives
>not 3
embarassing desu
>>
File: rational.png (18KB, 736x111px) Image search: [Google]
rational.png
18KB, 736x111px
>>58680758
apparently python can do rationals like this only with an external lib
but sympy is nice
>>
>>58680815
>not built in
sad!
>>
>>58680805
Yeah, the lowest I can do is 5: atom, car, cdr, cons, and eq. McCarthy added the others later. Oh well!
>>
>>58680801
What, like Scheme? :^)
>>
>>58680746
Yes

>exceptions
Classes only used in implementations
>>
File: blind.png (676KB, 1269x721px) Image search: [Google]
blind.png
676KB, 1269x721px
>light IDE themes
>>
>>58681113
New thread
>>
New thread:

>>58681139
>>58681139
>>58681139
>>
>>58681138
>>58681145
fags
>>
>>58681145
Are you fucking braindead?
>>
>>58681138
>>58681145
Nicely done, boys.
>>
>>58681112
>IDE
Thread posts: 314
Thread images: 38


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.