[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: 38

What are you working on, /g/?

Old thread: >>58473197
>>
First for C++ is complete shit.
>>
>>58480716
Depends which industry we're talking about. There's a demand for both C++ and Java programmers. But they're both easy enough to learn that you don't need to pick one over the other.
>>
File: 7phuJaq6[1].jpg (42KB, 512x512px) Image search: [Google]
7phuJaq6[1].jpg
42KB, 512x512px
First for D.
>>
>>58480731
why
>>
>>58480766
Good one
https://godbolt.org/g/lNsRMn
>>
>>58480784
I-it's only temporary, D will rule the world.
>>
If you have 2 activities equally (for example programming and drawing), and you want to do it professionally both, which one would you choose?
>>
>>58480822
Programming, and drawing after work.
>>
>>58480822
Well professionally I would want a job that didn't involve drawing furry art for autists for a living, so programming. Then drawing as a hobby. Also, don't you think this is an incredibly biased place to ask such a question?
>>
>>58480822
Programming, draw for commissions(if you're good enough)
>>
>>58480784
>import std.stdio;
Talk about fucking stupid.
Also why the hell is the output making two calls to fprintf?
>>
What compilers and languages existed back in times of MacOS 8.1 for m68k Macintoshes?
>>
>>58480704
>What are you working on, /g/?
Attempting to trick the NVMe driver into making the SSD DMA blocks into an arbitrary bus address.
>>
>>58480861
You should make porn games. It's what I'd do if I could draw.
>>
File: trust.webm (3MB, 976x550px) Image search: [Google]
trust.webm
3MB, 976x550px
>>58480912
>trick
w-why?
>>
>>58480960
for fun and games, but also for profit

Can make the SSD write directly into GPU memory (RDMA), instead of having to transfer first to RAM and then to the GPU.
>>
>>58480990
interesting. What would the purpose of this be though?
>>
>>58480860
> involve drawing furry art for autists for a living
You have a misunderstading of modern drawing, take a look at ArtStation, there are a lot of artists who draw concept art for games and films.
>>
>>58481045
It was a joke.
>>
http://esr.ibiblio.org/?p=7294
Tension is rising
>>
>>58481009
It will be faster and require less synchronization between disk driver, OS and GPU driver.
>>
>>58481111
Quicker for what function? I can only imagine this would be quicker if the data set was significantly larger than the available RAM. If the data set could be cached in RAM then doing a transfer from SSD to GPU would be slower and therefore redundant. Unless you were crunching very large sets of data, this wouldn't be much faster.
>>
>>58481111
Is is actually practical though? Bypassing the OpenGL driver sounds like begging for trouble.
>>
>>58481080
I didn't get it.
>>
File: 1483073157801.jpg (110KB, 1280x720px) Image search: [Google]
1483073157801.jpg
110KB, 1280x720px
/g/ cool kids club checklist

[x] hate OOP
[x] hate IDEs
[x] use only Haskell
[x] never produce actually useful software (this is important)
[x] wear knee socks
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] hate popular Linux distributions (far too intelligent for them)
>>
I wrote some hacky shit code. It returns -1 if n<0, 1 if n is in [0, 1] and 1 if n>1

int f(n){
return n.compare(0.0) & n.compare(1.0)
}


Whaddya think?
>>
>>58481201
>[x] hate OOP
>[x] hate IDEs
>[x] use only Haskell
>[x] never produce actually useful software (this is important)
>[ ] wear knee socks
>[ ] tiling window manager
>[x] dark-like-my-soul customized colors
>[x] hate popular Linux distributions (far too intelligent for them)
>>
>>58481202
I think its also extendable for any a>b
>>
>>58481202
so basically
return (n<0) ? -1 : 1;

?
>>
>>58481201
you forgot:
[x] regard others as shit because they didn't read SICP
>>
Resources for wrapping my head around continuations?
>>
>>58481201
[x] hate OOP
[x] hate IDEs
[ ] use only Haskell
[ ] never produce actually useful software (this is important)
[ ] wear knee socks
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] hate popular Linux distributions (far too intelligent for them)
OOP as in Java OOP.
>>
>>58481223
not quite, if n is between 0 and 1, return 0
>>
>>58481201
>[x] hate OOP
>[x] hate IDEs
>[] use only Haskell
>[] never produce actually useful software (this is important)
>[x] wear knee socks
>[] tiling window manager
>[x] dark-like-my-soul customized colors
>[x] hate popular Linux distributions (far too intelligent for them)
>>
Post CV fodder projects, need to fill up my githubs. Cool repos to contribute to also appreciated.
>>
>>58481259
Flashy looking simulation, shows that you're ""full stack""
>>
>>58481259
https://github.com/torvalds/linux
>>
>>58481276
Looks shit
>>
>>58481268
What kinda simulations are we talking about here? Like those webgl physics memes?
>>
>>58481276
Unsafe, better rewrite it in Rust :^)
>>
Serious CS knowledge dump here:

http://okmij.org/ftp/
>>
>>58481284
If you want an actual suggestion, when I was in uni, we coded a fabric simulation over a sphere. You don't have to code a full physics sim, just push the fabric outside a given radius every tick.

The fabric is basically an array of points. Apply gravity to points, use hooks law to simulate a spring between adjacent points, repeat ad infinitum.

I made every square a different color and it looked like a million bucks. If you've had experience coding, it'll take you a couple of afternoon.
>>
What is your stance on parenthesis in mathematical operations? Would you write
y = a + b * c;

or
y = a + (b * c);
>>
File: spj.jpg (31KB, 224x223px) Image search: [Google]
spj.jpg
31KB, 224x223px
>>58481311
SHUT IT DOWN
>>
>>58481346
Don't be daft, Simon loves that shit.
>>
>>58481201

>[ ] hate OOP
I use a purely object oriented language.
>[x] hate IDEs
Yep! Software should be simple and easy to navigate.
>[ ] use only Haskell
I don't use Haskell at all!
>[x] never produce actually useful software (this is important)
When I write code, it's mostly because I find it interesting. Or it's coursework.
>[ ] wear knee socks
Knee socks are for people who get down on their knees too often.
>[ ] tiling window manager
Nah.
>[x] dark-like-my-soul customized colors
Easier on the eyes.
>[ ] hate popular Linux distributions (far too intelligent for them)
I use Ubuntu. Less hassle.
>>
>>58481336
depends. More often than not, I'll do the latter. I find the first one readable enough, but when things get more complicated it makes more sense just to add parenthesis everywhere to make it easier to follow. So even for simple ones I just add the parenthesis to keep everything consistent.
>>
>>58481336
>;
>>
>>58481368
But knee socks are not just for the homosexuals, Ruby.
>>
>>58481336
The second option. As much as I want the
you dont need math to code, everyone should learn to code XXD
subhumans to struggle[spoiler]die[/spoiler], it's much more obvious at a glance.
>>
>>58481336
I expect my coworkers to know the order of mathematical operators.
>>
>>58481336
Always the second one.
>>
>>58481387

You're right, they're also for women!
>>
>>58481424
Women can be homosexuals too, Ruby.
>>
>>58481368
>Knee socks are for people who get down on their knees too often.
But what if it was a game theory scenario? Two people are in seperate and isolated booths, unable to see each other but able to communicate through a walkie talkie system. If they both leave the booth without wearing the knee socks, then they're both pronounced "totally not gay", but if one of them wears the socks, then they're both pronounced "gay as fuck". Then they have to communicate and do all that shit.

>>58481336
Second one, every time. I have a paranoia about it, even with calculators. I feel that if I don't explicitly state it then it'll be interpreted wrong because of some Chinese fuck who doesn't understand order of operations.
>>
>>58481444
For a straight guy, you spend a lot of time thinking about knee socks...
>>
>>58481453
Welcome to /dpt/.
>>
>>58481453
Wearing knee socks tends to do that to you. I'm pretty fucking gay.
>>
>>58481431
That is true. But women can be heterosexual and wear knee socks.

>>58481444
Walk out without kneesocks. Even if you are pronounced gay as fuck, at least everyone know's who's the bitch in the relationship :P
>>
File: 61756692.jpg (60KB, 357x347px) Image search: [Google]
61756692.jpg
60KB, 357x347px
>>58481463
>>
>>58481464
But straight men can wear knee socks too, Ruby.
>>
File: 1483036200950.jpg (23KB, 512x512px) Image search: [Google]
1483036200950.jpg
23KB, 512x512px
>>58481360
we can't let them have the knowledge
>>
>>58481502
I do not know too many who do.
>>
>>58481539
Do you know many people who wear knee socks?
>>
About the same amount who identify as homosexual. Coincidence?
>>
>>58481545
I know a few. They're all at the very least bi... or straight women.
>>
>>58481561
What about women?
>>
Someone should write up a simulator for different colours and patterns of knee socks. /dpt/ needs it by the looks of it.

>>58481539
So you know at least one? Who is it? Louis XIV?
>>
>>58481569
Women are just gays with nice faces, everyone knows that.
>>
>>58481566
But what about you?
>>
>>58481587

I wear solid black crew socks.
>>
>>58481602
You've never experimented?
>>
C fags explain to me argc and argv
Very sleepy, don't have the energy to read and understand it from the book

Also, explain to my when a person would use stdout, stdin, stderr

Thank you
>>
>>58481618
argc is an int and argv is a char**
>>
>>58481618
Fuck you. Type it into google. Programming requires effort.
>>
>>58481624
>inb4
int main(int argv, char** argc) {
>>
>>58481618
Bunch of shit handed to the whatchamajig by the thingymabob that did the diddle.

You use STDout when you want to give someone and STD, and STDin when you get an STD. STDerr is thrown when you die due to an STD.
>>
>>58481618
Google answers homework questions.
>>
>>58481636
I do this because it's one less character to type.
You can use it the same way, so what's the difference?
>>
>>58481618
>C fags explain to me argc and argv
argc -> size of argv
argv -> program name + arguments
>>
Who else here /can't program for shit/?
>>
>>58481655
>>>/out/
Leave your knee socks by the door.
>>
>>58481655
just you

good place to learn tho
>>
>>58481658
Rude
>>
>>58481655
too smart to program
>>
>>58481655
>tfw to intelligent to program for shit
>>
>>58481616
Crew socks are comfy enough for me, and take less time to put on and take off. Moreover, the nature of living in Washington is that your socks WILL get destroyed by water seeping through your shoes, so expensive socks are not a very economic choice. This, of course, does not stop a lot of people.

>>58481618
If you are too sleepy to understand it from a book, you will be too sleepy to understand it from our explanations. I should probably head to bed soonish myself, because it is 6 AM.
>>
>>58481650
>>58481649
>>58481648
>>58481636
>>58481630
>>58481624
Please, I want to get this done before I sleep, I'm almost done with this C bullshit
Explain in laymen terms wtf it's used for
Actually help someone for once in your lives you useless faggots
>>
>>58481687
Fuck you, I was helping you.
Not gonna anymore.
>>
>>58481687
Who the fuck do you expect to help you with that piece of shit attitude? If you can't figure out basic stuff by yourself just drop programming already
>>
>>58481687
In the time you spent replying to us you could have Google'd it and understood it. That reply isn't going to help.
>>
>>58481687
Whats your major, freshman?
>>
rate program lads
https://github.com/wrvc/misc/blob/master/roman.c
>>
>>58481683
But knee socks are not just for homosexuals, Ruby.
>>
>>58481710
Replace goto START; with continue;
Don't you ever use goto or labels ever again.
>>
>>58481687
You can literally Google the answer in a few minutes.
>>
>>58481710
goto is cancer, it hasn't been used in modern programming for decades. It can create unintended behavior. Gimme two secs
>>
>>58481710
0/10 that won't help me seige Constantinople.
>>
>>58481733
Programming newfag here, why is goto considered cancer?
>>
File: 1461388282016.png (736KB, 1050x870px) Image search: [Google]
1461388282016.png
736KB, 1050x870px
>>58481740
too soon
>>
>>58481729
>muh goto considered harmful
>>
>>58481710
>goto
replace with continue
>i,j,k,c,v
rename them into something useful
>>
I want to make my own browser.
>>
>>58481710
>>58481733
And good lord, variables need descriptive names. This isn't (I wanna say...) FORTRAN
>>
>>58481758
Why the fuck would you use goot if you can use continue?
You should always use the option with most constraints.
>>
>>58481729
>>58481733
>>58481740
>>58481760
>>58481768
dont ever talk to me or my program again
>>
>>58481749
GOTO may lead to mess in the code.
>>
>>58481749
http://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf
Have fun.
>>
>>58481779
Can you please explain how, exactly? I'm interested to know.
>>
>>58481784
nevermind >>58481783
>>
>>58481698
>>58481701
>>58481702
>>58481709
>>58481730
Useless autists
I'm off to sleep
>>
File: 1483916193167.webm (3MB, 1612x892px) Image search: [Google]
1483916193167.webm
3MB, 1612x892px
>>
>>58481804
See you later, lazy dude.
>>
>>58481815
>delphi
ayyy
>>
>>58481749
Very briefly, it's very often symptomatic of other issues. To lean on goto, is to forgo best practices For example in your code, it would be much clearer to write
while( i >= c[j] ) {
i -= c[j];
k++;
}

rather then using your goto statement.
>>
Where do people even learn to use goto statements? Who teaches that? Did they pick up a book that's over 40 years old?

>>58481804
And nothing of value was lost.
>>
>>58481804
See you at the prom, homo.
>>
File: 1483698762422.jpg (88KB, 773x960px) Image search: [Google]
1483698762422.jpg
88KB, 773x960px
>>58481852
Assembly.
>>
>>58481784
10 Back in times
20 GOTO 60
30 , though, is essentially a CPU jump command.
40 In modern languages
50 GOTO 90
60 was the only command able to fluent
70 on the command flow.
80 GOTO 30
90 may not exist, since there are other commands which let to get out from the loop.
Still, GOTO may be useful to jump out multi-nested loops. GOTO is like a knife - you tell little kids that it's forbidden to use knife until they get older, so they wouldn't cut their fingers.
>>
File: 1482425804508.jpg (92KB, 358x429px) Image search: [Google]
1482425804508.jpg
92KB, 358x429px
>>58481846
>postfix ++
>>
Goto is not evil in and of itself. There are, however, many reasonable alternatives to goto, such as break, continue, returning early from a function, and regular old looping constructs, depending upon the case. Among the few legitimate uses where a goto makes sense are breaking out of a nested loop early, and jumping to a cleanup section in a function. One case I found myself wishing I had goto was in an operating systems class, where I was allocating multiple resources, which could fail in allocation, requiring the release of all already held resources. The language I was using had no RAII or goto, so if had multiple conditionals where I would release all held resources by the function. It was a bit ugly. With a goto, I could release all resources at the end of the function in reverse order of allocation, and put a label in front of each one.
>>
>>58481856
Well yeah, that's the only place where it still makes any sense. But who learns that first when it's fallen out of common usage? You'd have to want to start programming, decide to learn assembly for some reason, then go to C.
>>
>>58481846
By the way, you can also replace
if (k) while (k--) printf("%s", v[j]);
with
while (k--) printf("%s", v[j]);


>>58481776
>>58481852
>>58481855
Ya'll are off the fucking chain
>>
>>58481872
just use callCC
>>
>>58481872
You want continuations.
>>
>>58481899
>>58481904

I'd personally need a better reason to use a completely new package than that
>>
>>58481872
tl;dr
>>
>>58481899
>>58481904
Those might also have been nice. But this was a custom programming language the professor borrowed from another professor, designed for teaching kernel programming. It was sort of Pascal-like.

>>58481936
Goto okay in specific situations.
>>
Programmers don't like using jump commands because they don't like being reminded of physical exercise.
>>
Reading through the classic Gang of Four Design Patterns book now. I've known of it for years and some of the larger patterns, but how relevant is it still today? I always assumed it was deprecated, so I put off reading it for years until now.

Also how good is the Scott Meyers Effective C++ (the C++11 and C++14 edition)? I read the old 90s edition, but kind of gave up on keeping up with C++ after awhile because it got too expansive and complicated for little reward.

Also am I a complete dumb ass for reading the classics like Clean Code, The Pragmatic Programmer, The Practice of Programming, etc while my peers seem to be reading the latest meme Javascript packages? I honestly enjoy reading Math and algorithms books over most of this stuff, so I try to only read the essentials and stick to math textbooks.

Thanks to any of the older veterans who respond.
>>
>>58481989
I'M 6'12 and JACKED, ILL BASH YOU

Is... is that what you want?
>>
>calls herself a programmer
>has never used set/longjmp

lmao
>>
File: 1484099528997.gif (3MB, 355x201px) Image search: [Google]
1484099528997.gif
3MB, 355x201px
>>58481996
>design patterns
>>
>>58481998
Yes please daddy.
>>
File: 1430872326149.jpg (62KB, 413x423px) Image search: [Google]
1430872326149.jpg
62KB, 413x423px
I'm trying to work with multi-dimensional arrays in C but I'm having an issue, I need an array of pointers to arrays, the arrays that are pointed to are just arrays of ints, but the size of them isn't the same, I'll know the sizes at compile time but I can't define them in the type itself. On top of that I need pointers to those arrays of pointers too. This is causing me issues.

Essentially I want to be able to do this.
typedef int layer3[]; //array of ints
typedef layer3 **layer2; //array of pointers to arrays of ints
typedef layer2 **layer1; //array of pointers to arrays of pointers to ints

layer1 layerSet1 = (layer1[1][1][2]){ //layer1, set 1
{ //layer2, set 1
{20,6}, //layer3 set 1
{20,7}, //set 2...
{20,8},
{20,9},
{20,10}
}
};


It doesn't matter how it's defined, I just need to be able to define the structures easily in literals, and they have to be 3 dimensional like that. The
(layer1[1][1][2])
is not valid but I want to be able to do something like that, have the array size unknown at the typedef but defined later in a literal, still at compile time (I won't do anything at run time).

Is something like this possible? I'm not super familiar with C's syntax surrounding multi-dimensional arrays, nor am I familiar with macros. Is there syntax for what I need or could/should I learn macros to deal with this?
>>
>>58481996
What about the wizard book?
>>
>>58482009

This is a nice meme, but can you pontificate on it? I know in the industry they typical talk in terms of patterns, not necessarily strictly referring to the original definition, but still in the same abstract idea.

I also read a modern design patterns in C++ pdf a few years ago that had some neat applications (it was a hundred or so slides, I can't find the source anymore).
>>
>>58482042
just program properly
>>
>>58482029

I haven't read it. I glanced at the chapters and saw nothing of value. I would probably read it if I wanted to create my own programming languages, but that's not my field of interest.
>>
File: What.png (51KB, 627x620px) Image search: [Google]
What.png
51KB, 627x620px
>>58482028
>//array of pointers to arrays of pointers to ints
You sure you're not overthinking this mate? That's a lot of pointers pointing to pointers pointing to ints, is it really necessary?
>>
>>58482042
People make fun of design patterns for being overused and over depended upon. But they are somewhat eye opening, and it helps to have a bunch of standard approaches to problems in your head when discussing how to solve certain problems with your work peers.
>>
>>58482068
Design patterns are fucking dumb and symptomatic of bad programming practice.

90% of them exist to work out "how to do X with inheritance"
maybe stop using inheritance, you stupid OOP idiots
>>
>>58482129
>a dog is not an animal.
you deserve an award
>>
>>58482061
I'm not really sure, but I'm pretty sure. Basically I need to iterate over those ints 1 at a time, between those I need to iterate over another set of them, not back to back but interleaved.

Kind of like this
layer1[0][0][1]
layer1[0][1][1]
layer1[1][1][1]
layer1[0][0][2]
layer1[0][1][2]
layer1[1][1][2]
etc.
I'm using pointers because the actual data will be larger and I need to switch between them very quickly. At any point I need to be able to stop, not after a whole set but only after a single point, so it has to be broken up into 3 dimensions as far as I can tell.

It's for video, layer 3 is a set of frame data, layer2 is a set of frames, and layer1 is a collection of animations, I have to play a frame from 1 animation, then play the frame from another animation, interleaving them, so I have to keep track of which frame from which animation the "cursors" are on.

I might be over complicating the solution but the requirements are already complicated. It's be much easier if it didn't have to be interruptible, it'd be even easier if they didn't have to be interleaved.
>>
>>58482129
Design patterns are good, but don't implement them literally.
i.e. don't name your classes x[controller|model|view]
>>
>>58482139
class Dog : public Doggable {
>>
>>58482028
Try doing whatever you're doing without typedefs
The typedefs come after you have a pattern
>>
File: oop p2.png (57KB, 682x473px) Image search: [Google]
oop p2.png
57KB, 682x473px
>>58482139
>>
>>58482129
>maybe stop using inheritance, you stupid OOP idiots
I'm not an OOP programmer. I do stuff functionally when I can. But on rare occasion OOP is useful, and it's somewhat required for most jobs.

If you're going to OOP, you might as well know how to do it properly.
>>
>>58482203
>If you're going to OOP, you might as well know how to do it properly.
You mean message passing?
>>
>>58482203
you probably think structs are OOP
>>
>>58482218
poor assumption. you're wrong.
>>
>>58482145
I'm sorry it's late and I can't quite visualise this. I know it's possible though, but I think there's a simpler way to go about it that doesn't involve pointer inception. Good luck though.
>>
>>58482185
That piece of code is a poor example of oop.
>>
why can't I allocate arbitrary amounts of bytes in java? I want to pack information but even a long is too short. any solutions?
>>
>>58482263
byte[] b = new byte[size];

?
>>
>>58482278
is it as efficient as a primitive?
>>
>>58482289
It's a heap allocated array.
>>
File: OOP.png (69KB, 1210x467px) Image search: [Google]
OOP.png
69KB, 1210x467px
>>58482258
that image is optimum OOP, it's what they use to trick people into thinking OOP is good, and it's shit
>>
File: 1464632537832.png (152KB, 1948x858px) Image search: [Google]
1464632537832.png
152KB, 1948x858px
>>
>>58482300
but I cant biteshift it directly and need steps between and a more sophisticated method to extract or pack. I wonder at what point it would get more efficient than all those bitshifts in a theoretical arbitrary long int.
>>
>>58482321
You could use the JNI to do your tricks.
>>
>>58482158
I wrote something to deal with a 3D array like that, I just don't know how to initialize that array with semi-dynamic sizes, if I used fixed length arrays the tests are working fine, it's just defining that data that's giving me problems. I need a type inbetween fixed length and variable length, the data isn't dynamic but it's not all the same either.

There seems to be a lot of alternatives I could take but none of them preserve the literal notation, other approaches would push the memory onto the heap too, which I'm not opposed to here but it calls for me to handle sending some literal to a function for each set of data instead of just defining them all literally and referencing them all in layer1. There might not be a way to do this simply.

>>58482244
Thanks, Anon. I'll keep thinking.
>>
>>58482367
that's actually a good idea. I bet it would even speed things up
>>
>>58480766
D(ead)
>>
>>58482321
You can use BigInteger.
>>
>>58482408
Probably not, crossing the jni boundary isn't free.
>>
File: 1483899740618.png (276KB, 600x558px) Image search: [Google]
1483899740618.png
276KB, 600x558px
>his language calls integers BigIntegers
>>
File: thermal paste.png (83KB, 801x500px) Image search: [Google]
thermal paste.png
83KB, 801x500px
just fucking kill me now it's still building
>>
reposting my Scheme question
>>58480794
>>
>>58482434
of course. but if I go native I can move big parts of my code to sepples because the communication would be very limited. or I use byte arrays.
>>
web application framework in ARM64 assembly
currently writing PCI network drivers
>>
>>58482475
The only things you need to know is the difference between compile time and runtime, list operators, and then the macro functions which can be hard.
>>
File: 8b2.jpg (120KB, 853x543px) Image search: [Google]
8b2.jpg
120KB, 853x543px
>>58482434
>>
>>58482469
Don't try compiling LibreOffice, it takes literally half a day on a laptop.
>>
>>58482321
use C# instead
>>
File: Screenshot_20170114-114706~01.png (56KB, 935x340px) Image search: [Google]
Screenshot_20170114-114706~01.png
56KB, 935x340px
Could I get some hints on this? I don't want the full solution, just a little guidance for a newfag
>>
>>58482439
>his language made him so autistic he cares about trivial things such as the name of a Big Integer class (>64)
>>
File: 1484406781418.jpg (64KB, 633x699px) Image search: [Google]
1484406781418.jpg
64KB, 633x699px
>>58482622
>BigInteger
>not the worst, most awful OOPified Enterprise name of all time
>>
If evolution is real, why does Java still exist?
>>
>>58482628
it's an integer class that supports more than 64 bit width. It isnt called BigAbstractIntegerBeanBigFactoryForYou my good pal.
>>
>>58482618
countSS sub = length . filter (== sub) . subsequences
>>
>>58482652
N-no bully, but I don't understand
>>
>>58482618
strstr()
>>
>>58482642
>if evolution is real, then why do humans have an appendix?
>>
>>58480904
please notice me
>>
>>58482469

> tfw took me 13h to build the QT5 to Android i386/x86_64 and Mingw i386/x86_64
>>
>>58482412
that's a byte array larping as primitive
>>
>>58482673
C
>>
>>58482677
no it's its own object.
you must use its methods to perform arithmetic
>>
>>58482677
Easier to use their implementation than write your own.
>>
>>58482646
Integers are unbounded. Describing an integer as 'big' is meaningless.

Java's int and long are misnamed. They are Galois fields, not integers.
>>
>>58482702
stop shitposting brainlet
its an intuitive name
>>
File: 1478516972085.jpg (10KB, 250x208px) Image search: [Google]
1478516972085.jpg
10KB, 250x208px
>want to program something
>can never think of anything to make
>>
File: 1459695501724.jpg (23KB, 338x430px) Image search: [Google]
1459695501724.jpg
23KB, 338x430px
>>58482726
I know that feel
>>
>>58482720
No, it isn't.

Suppose you started using a new language and its String type were limited to a maximum length of 16 characters. Wouldn't you find that bizarre, confusing, and non-intuitive?
>>
>>58482720
What about 'ArbitraryPrecisionInteger'? That would be the most accurate name.
>>
>>58482726
fucking hell this
>>
>>58482726
>think of something to make
>don't want to program
>>
>>58482726
>>58482745
Write a language.
>>
>>58482702
>get a BigInteger
>ooh boy this number's gonna be huge
>it's actually 3
>>
>>58482726
make a game. Everyone likes games...
>>
>>58482726
>>58482745
>>58482749
duplicate image sorter
and i don't mean the easy same md5. i mean the image it self. similar image, different dimensions, different orientation, like that

you can use it so sort your image macros and porn
>>
>>58482754
You guys should get together.
>>
>>58482748
It's an integer. Not a BigInteger, an ArbitraryPrecisionInteger, or a WeAlreadyNamedSomethingElseIntegerInteger.
>>
>>58482702
No they aren't. BigInteger is signed, and even if it wasn't multiplication and addition in GF(2^n) is not the same as in Z.
>>
>>58482754
>idea guy
>>
>>58482758
ive made a compiler and interpreter
>>58482760
been thinking about this, cant figure out what to make
>>
>>58482748
ArbitrarySizeIntege you mean
>>
>>58482790
op, just figured out what game to make

hahA! not telling tho
>>
>>58482790
make a game dev tycoon but instead of making games you make fizzbuzzes in 500 different languages
>>
>>58482776
What?

Integers are signed, just like Java's BigInteger.

Of course multiplication and addition in GF(2^n) is not the same as in Z. That's the point of what I was saying. Multiplication and addition on Java's int and long types is also not the same as in Z, so they should not be named int and long.
>>
>>58482817
>/dpt/: the game
>>
File: Screenshot_2017-01-14_11-10-22.png (3KB, 341x21px) Image search: [Google]
Screenshot_2017-01-14_11-10-22.png
3KB, 341x21px
my god it finished
>>
File: 1484178231488.jpg (2KB, 124x87px) Image search: [Google]
1484178231488.jpg
2KB, 124x87px
What's so great about C#? I see it shilled everywhere on this board why the fuck?
>>
>>58482858
Pajeets

Pajeets everywhere
>>
https://www.youtube.com/watch?v=w2H9Xm6aiwo

>you will never be a C EXPLORER
why even live
>>
>>58482843
>A JAVA SHITPOSTER HAS APPEARED!
https://www.youtube.com/watch?v=-uFpYEOGqV4
>>
>>58482793
'Precision' actually means the same thing in this context, since you lose precision when you overflow and get the wrong answer.
>>
>>58482858

It's good.
>>
>>58482866
>in C
>files are .cpp
Yeah that faggot should just kill himself
>>
>>58482830
I mean the operations + and * don't look remotely like + and * over Z. Here's a page with a simple example for GF(2^8) http://www.cs.utsa.edu/~wagner/laws/FFM.html
>>
>>58482901
kek i see what you did there
>>
>>58482901
Ranjeep, please do the needful.
>>
>>58482899
BigIntegers don't overflow, the implementation allocates more memory if it needs more space.
>>
>>58482901
MURICA!
>>
http://selfdrivingcars.mit.edu/deeptrafficjs/

Anyone tried this with any success?
>>
are you guys racist against indians?

all the indians ive met have been good guys, cant say the same for paki

it's possible im ok with them because my job opporunities will be so much more secure than your simple CS, which is just a hobby to me
>>
>>58482941
Uh... yes, that's why I'm suggesting 'ArbitraryPrecisionInteger' as an alternative name.
>>
>>58480704

Any ideas why my ray tracer looks like this? this almost seems like a familiar bug.

I'm not gonna try to post the code because I'm only looking for broad answers

it's trying to draw 1 sphere with a radius of .5 that is 1 unit away from the camera by painting it red if the ray is a hit and black if it is not

I tried two common methods of ray-sphere collision detection. Both of them give me this same result.

As the sphere moves away from the frame, the wedges get smaller as if the wedge width is inversely proportional to distance squared
>>
>>58482958
>he thinks programming won't be the last profession to be automated, after everything else
>>
File: just fuck my shire up.png (64KB, 450x500px) Image search: [Google]
just fuck my shire up.png
64KB, 450x500px
>>58482958
i don't hate them but i don't want to be replaced in my country by them
>>
File: Chisala-7.png (70KB, 546x430px) Image search: [Google]
Chisala-7.png
70KB, 546x430px
>>58482986
lmao
>>58482991
im sorry, but if an indian or an asian kid is brighter than a white kid (often the case) they ought to get 'replaced'
if you care about merit and intelligence that is
>>
File: 1478440676086.png (663KB, 881x612px) Image search: [Google]
1478440676086.png
663KB, 881x612px
/g/, I did some simple stuff with the Delphi meme like converting roman numerals to arabic ones or drawing a triangle made of * with a given length, but now I want to move on to more complex things. What do?
>>
>>58483008
Get a real programming language
>>
>>58483008
install gentoo
>>
>>58483006
IQ is not the only measure of value
>>
>>58483006
I care about hygiene as well as intelligence, so you lose, loophobe.

Also
>thinking rampant cheating on tests means Indians/Chinese are actually smarter and won't fall flat on their ass outside academia
>>
>>58483006
all this IQ and they still can't poo in loo

when "scientific data" contradicts real life like this, i'd say the methodology or conclusions are wrong
>>
>>58482972
>I'm only looking for broad answers
There's a bug in your code.
>>
>>58483055
http://www.bbc.com/news/world-asia-india-31960557

http://www.wsj.com/articles/foreign-students-seen-cheating-more-than-domestic-ones-1465140141

http://www.theatlantic.com/education/archive/2016/03/how-sophisticated-test-scams-from-china-are-making-their-way-into-the-us/474474/
>>
File: 1483532264717.png (104KB, 2000x2245px) Image search: [Google]
1483532264717.png
104KB, 2000x2245px
>>58483072
>>58483055
>>58483053
>>58483037
tell me your honest opinion
do you believe that immigrants kid aren't brighter than the average dull white kid
I am referring to chinese and selected indians (like brahmins)

i know it hurts
>>
>>58483144
If they're so bright why do they literally shit in the streets?

No amount of graphs will help you when real life verifies their "brightness"
>>
>>58483155
ask this question in 12th century and be arab or persian
>>
>>58482129
Except most pattern books will tell you to prefer composition over inheritance
>>
>>58483155
If the burger is so smart, then why does he shart in the mart?
>>
>>58483165
Pity most OOP programmers have never read a design patterns book.
>>
>>58483184
What do I care about some 3rd world country like Kwanzania?
>>
>>58483144
Immigrants (with the exception of between countries that have freedom of movement, like EU member states) do not have the same intelligence distribution as the population as a whole of their country of origin: more intelligent people are more likely to emigrate than less intelligent people (it's much harder to immigrate to a first world country if you don't have a degree, or skills, or a offer for a job in a sector with a skills shortage, etc.), so immigrant kids are likely to come from smart parents, and intelligence has some degree of heritability.

So Indian immigrants probably have a higher mean IQ than the native population of their destination country, but you can't extrapolate from that to say that Indians are more intelligent than them. If India wasn't a shithole you'd see the same in the opposite direction: the smartest whites moving there, and their kids scoring higher than natives' kids.
>>
>>58483230
>, but you can't extrapolate from that to say that Indians are more intelligent than them.
but IQ tests run in india also show they are more intelligent than westerners. Where's the evidence that they aren't?
>>
>>58483230
My point exactly.
>>58483281
No they don't, generally.

Brahmins are likely more intelligent, but those are a very small group.
>>
>>58483281
>thinking cheating isn't rampant in India
>>
>>58482263
I thought about it an will just use 2 parallel long arrays. there are too many small calls to the underlying data structure for jni to be useful.
>>
>>58483291
>No they don't, generally.
proof?

>>58483308
I simply don;t assume the IQ tests definitely are cheated on in order to back up a narrative.
>>
>>58483334
No, you simply ignore all the evidence that cheating occurs in order to back up your own narrative.
>>
>>58483006
its not about replacement it's about protecting the jobs while we have them. indians abuse the h1b system of the US to send in shitty programmers to depress wages and take up lottery positions that should be filled by other more important professions.
It's a shitty system that takes advantage of shitty, desperate people. That's why i hate them.

if you're outside the US, it's probably not an issue.
>>
>>58483363
Don't forget there's also the diversity lottery visas, which serve no purpose other than to make the US more 'diverse'.
>>
>>58483352
I don't ignore it, but evidence of cheating is not proof that indian IQ's are not on average higher than western ones. It simply means we don't know.
>>
>>58483407
Look, I will consider that your test is evidence of higher IQ and that higher IQ is evidence of higher intelligence when the average indian can do the following things:

- not wipe his ass with his hand after shitting
- not bathe in a sewer river
- not shit in the streets
- not spit on the sidewalk every 5 seconds
- start taking regular showers to remove the curry smell
- have running water

Until then, I will treat your tests the same way I treat crystal healing, astral travel, and professional wrestling.
>>
can someone explain to me the stack in some common architectures(x86, MIPS, SPARC, PPC, etc.)
>>
>>58483645
x86 and MIPS

http://eli.thegreenplace.net/2011/02/04/where-the-top-of-the-stack-is-on-x86/

https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/stack.html
>>
>>58483768
thanks!
>>
>>58482618
https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm
>>
>>58483596
don't those things just mean the country is poor though? Not exactly directly related to intelligence.
>>
How do you set global variables in OpenCL?

In my regular code, I have Char[ x , y ] (2D) which denotes the game map, each element/char denotes a tile. Afaik I cant give the GPU a 2d array, so i have to convert it to 1d. This isn't a problem since you can access it like array[width * row + col] = value. But I need to set Width as a constant/global variable for all the threads in the gpu for easy indexing.

Does anyone know how to set it?

An alternative would be to give it to the gpu and to pass the width on to each method but that's ugly code imo.

i want something like this:

__constant int _MapWidth;
__constant char _GameMap[];


__kernel void device_function(__global char* GameMap, int width... )
{

_MapWidth = width; //set global Width
_GameMap = GameMap; //set the given map as read only (this wont be manipulated)

}
>>
anons, i wanna be a hacker, how?
>>
>>58484261
They have toilets. They refuse to use them.
>>
>>58484344
Learn COBOL, it's what every professional hacker uses
>>
>>58483407
>>
>>58484366
Okay, but can u give me a detailed list of what I should study from the very beginning?
>>
For a scanned image, how much do you think this would be noise?

Imagine an x by y scanned image of a white piece of paper. For an average row, how much of this would be non-white pixels when converted to B+W?

If I scan a white page, process it to be B+W, random black pixels appear.
>>
Why do people still make dynamically typed languages?
>>
>>58484398
I wonder if china and japan train their people to make good IQ tests
>>
>>58484590
IQ alone is not useful for most things
>>
>>58484518
>If I scan a white page, process it to be B+W, random black pixels appear.

Change the threshold
>>
What are some programs I can make that would realistically prepare me for a programming job using python?
>>
>>58484604
I know, I'm not saying that
>>
>>58484693
Implement half a Common Lisp interpreter then write everything in that.
>>
File: we have bitwise ops.png (417KB, 3200x1080px) Image search: [Google]
we have bitwise ops.png
417KB, 3200x1080px
we have bitwise operations now
>>
>>58482042
>>58482068
>>58482129
Design patterns are a language. If two programmers know the same design patterns and both use them, it will be easier for each of them to understand the other's code.

On the other hand, design patterns are duplication. If the language was more powerful, the structures they describe would be abstracted away and reused. On top of that, most OOP design patterns are either plain harmful or irrelevant now that even the big OOP languages are integrating functional stuff.
>>
>writing a command line program for windows that reads clipboard contents as text then prints it out
>you can specify the format you want to get the clipboard data. if you specify plain text, it won't return anything if the clipboard has for example unicode text of bitmaps
>GetClipboardData returns HANDLE *

Is it safe to printf("%s", h) if it's kinda "guaranteed" to be text?
>>
>>58484715
could you say that again in english? sorry i'm not familiar with this subs vernacular

what's "common lisp interpreter"
>>
>>58480704
I hate C. What is up with using short vague names for variables?
>>
>>58484758
an interpreter of the programming language common lisp is what he meant
>>
>>58484758
It's a thing that interprets lisp, commonly
>>
>>58484398
Asian countries like China, Japan and Taiwan have a shitload of 'good' minds but very little exceptional minds compared to EU countries for exemple
Their students are manufactured to pass exams and enter prestigious unis, not earn fields medals... For the most part anyways
>>
>>58484758
>>58484776
>>58484782
https://en.wikipedia.org/wiki/Greenspun's_tenth_rule
>>
>>58484571
To facilitate retards.
>>
>>58484790
lmao this is really cool
>>
>>58484776
>>58484782
Eli5 how I would do that? I'm not familiar with lisp
>>
>>58484821
First you must get into the mindset of a commoner, you must dress in rags, till the fields for the lord of the manor, get drunk every night and fuck your wife with a pigskin condom, be illiterate and die of an easily treatable disease.

Only then will you be ready.
>>
>>58484821
No, you have to start crossdressing.

Knee high socks are very important. Buy yourself a dildo that can vibrate, put it up your but and for every 1k lines of code, increase intensity by 1.
>>
>>58484855
>>58484876
i already do this im slavic

now what
>>
>>58484949
Start waxing.
>>
>>58481336
(+ (* b c) a)
>>
>>58484754
stop being a bitch and test what happens
>>
File: tv_static.gif (2MB, 800x600px) Image search: [Google]
tv_static.gif
2MB, 800x600px
I'm working on efficient TCP socket handling, SOCKS handling, and better Tor integration in my decentralized TV project. Audio playback is working pretty OK now, and basic encryption has been implemented (via OpenSSL). I know I shouldn't hand-roll encryption, but I'm thinking about creating a hand-written RSA function set just to make it easier to decode (not without a fair amount of warnings though).

I also made an IRC channel (#basictv on Freenode) for it, hoping I can get away from shilling it on 4chan.
>>
>>58482652
lisp fags can't even compete
>>
>>58485035
>inb4 lisp solution which is just 5 characters, all of which are parentheses
>>
why can't lisps into function composition?
pisses me off honestly
>>
just made this palindrome checker without googling anything

chicker = input("yaleady know thha drill: ")
if chicker[::-1] == chicker:
print("yes its a palindrome")

else:
print("naw")


am i a programmer now?? what next?
>>
>>58485104
they can, see pipe thing
>>
>>58485104
(define (compose f g)
(lambda (x)
(f (g x))))
>>
>>58485127
>not reversed(chicker)
>>
>>58485147
>compose
in haskell, this is just .
>>
>>58485147
any shorter version?
>>
>>58485104
I used to think combinator-style programming was really cool but it's just obfuscation for little benefit for the most part. Also as soon as I got into dependent types I realized combinators were extremely painful to type whereas just using the lambdas works out nicely.
>>
>>58485174
Actually, it's
(f . g) x = f (g x)
.

You're confusing defining an operator with using the already-defined operator.
>>
i now can make a word counter in python
chicker = input("enter a sentance: ").split()
print(len(chicker))


is it just me or are these beginner projects a waste of time? dont know what else i could do though
>>
>>58485184
common, do you really like typing
(defun op (x)
...(fuck-me (in-the-ass x)))

instead of
(defun op (compose fuck-me in-the-ass))
>>
>>58485207
count = length . words

main = interact (show.count)
>>
>>58485219
I don't like Lisp.
>>
>>58485168
just tried and it doesnt work
>>
Can I somehow upload a compiler into my brain? Or at least an interpreter?
>>
>>58485231
fuck you you slut, go kill yourself
>>
>>58485237
you already have a meme compiler in your brain
>>
>>58485220
i dont understand
post it as code?
>>
>>58484994
Worked as intended. My concern is safety. Guess if works, then it's A-OK

>spurdo_yolo.jpg
>>
>>58485254
That is code. He just forgot the tags.
>>
>>58485244
WTF I love Lisp now!
>>
>>58485254
It's not for you to understand

it's to make him feel special
>>
File: 1453648836231.png (681KB, 840x720px) Image search: [Google]
1453648836231.png
681KB, 840x720px
>>58485237
e : \x.e
e e
x

remember capture avoiding substitution

>>58485254
it is code
>>
>>58485276
>>58485280
okay
im just a biology major who found out about programming last week so im a little lost
>>
New thread: >>58485295
>>
>>58485251
Huh? Can I write a haskell compiler in it? I really need one with me at all times
>>58485284
How do I use this?
>>
>>58485305
>How do I use this?
You implement it, then achieve satori.
>>
>>58485318
But how? I don't even know to to translate it by hand
>>
>>58485301
There's this programming language called Husklel that gets touted by pseudo-intellectuals as the best thing since sliced bread. That unsolicited example was just one instance of a common phenomenon wherein the sad Husklel programmer tries to show off his puzzle-oriented prettification prowess.

Just ignore them.
>>
File: 1483930295515.jpg (5KB, 228x221px) Image search: [Google]
1483930295515.jpg
5KB, 228x221px
>>58485339
I love it when imperatards get mad.
>>
>>58485366
anime name?
>>
>>58485384
The Grim Adventures of Ed Edd n Eddy
>>
>>58485384
Cheese-Shaped Mouse Desu Senpai Uguu~~~, obviously.
>>
>>58484727

Been there, done that, got bored with it
Thread posts: 334
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.