[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

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

Thread replies: 328
Thread images: 24
File: 1452460570325.png (2 MB, 2105x4000) Image search: [iqdb] [SauceNao] [Google]
1452460570325.png
2 MB, 2105x4000
What are you working on, /g/?

Old: https://boards.4chan.org/g/thread/52391746/
>>
First for Java

also fuck anime
>>
>>52399032
Second for anime is best
And java
>>
Thank you for posting anime.
>>
>>52398999
Thanks OP

>>52392659
>>52392690
>>52399012
Oh god, I really want to know what those are.
>>
File: 1452442269973.png (257 KB, 476x645) Image search: [iqdb] [SauceNao] [Google]
1452442269973.png
257 KB, 476x645
Help me find a pattern in this sequence, /dpt/.

(1, 1) (2, 1) (1, 3), (2, 3), (1, 5), (2, 5), (1, 7), (1, 9), (2, 9)


It's for something I'm working on. There should definitely be a pattern in there somewhere.
>>
I FUCKING HATE JAVASCRIPT

How the fuck do i create an object that holds variables and methods that operate on it?
How the fuck do i use data structures like a a map or a set?
How the fuck do you even sort shit?

Fuck this abomination of a language.
>>
>>52399061
im scanning 212.159.1.1 now out of curiosity.
>>
>>52399061
>>52399093
but alas
Nmap scan report for 1.core.plus.net (212.159.1.1)
Host is up, received user-set.
All 1000 scanned ports on 1.core.plus.net (212.159.1.1) are filtered because of 1000 no-responses
>>
>>52399069
Bait or just stupid?
>>
>>52399071
1. The "this" keyword inside an object method refers to the object.
2. I have honestly never encountered data structures called maps or sets. What language are you coming from that has those?
3. Array.sort()
>>
File: 1452420834970.png (536 KB, 600x720) Image search: [iqdb] [SauceNao] [Google]
1452420834970.png
536 KB, 600x720
>>52399117
Just stupid, I guess.

What's the problem, anon?
>>
File: ss2.png (97 KB, 1144x860) Image search: [iqdb] [SauceNao] [Google]
ss2.png
97 KB, 1144x860
>>52398999

>>52396882
>>52396882
>>
>>52399133
>I have honestly never encountered data structures called maps or sets.

You must have, probably without realizing it.
>>
>>52399117
???
you see a pattern?
why is there no (2, 7)?
>>
Any one know a good food recipe api with a free version (not limited time trial)? I want to make an app for myself to use to find and save recipes I like. At first I planned to scrape sites that I like and just find/store their recipes, but I'd rather use an api if I can.

So far, the best that I've found is Food2Fork, but one annoying thing about that is I don't think they provide the instructions, just a link to the actual recipe.

Any other suggestions?
>>
>>52399069
Could you give us more of the sequence?

>>52399071
You're an idiot.

>How the fuck do i create an object that holds variables and methods that operate on it?
var obj = {
myVar: 'foo',
getMyVar: function() {
return this.myVar;
},
setMyVar: function(newVal) {
this.myVar = newVal;
}
};


>How the fuck do i use data structures like a a map or a set?
Objects literally are dictionaries, but if you want real maps and sets:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

>How the fuck do you even sort shit?
myArray.sort((a, b) => a - b);


>Fuck this abomination of a language.
JS has many problems as a language but they have nothing to do with or even touch the "issues" you describe. Go read a book or something.
>>
>>52399162
trolled
>>
>>52398999
I'm working on learning Kernel dev. Also looking for a mentor of sorts as I'm learning C. Any takers? Telegram is @KTSDG
>>
>>52399104
>no response instead of port closed answer
Wow, whoever owns that machine has likely no clue what they're even doing.
>>
File: ttt.jpg (26 KB, 480x678) Image search: [iqdb] [SauceNao] [Google]
ttt.jpg
26 KB, 480x678
>>52399171
>>
>>52399133
>The "this" keyword inside an object method refers to the object.
I don't see any objects anywhere. All i see is a bunch of functions and variables that can hold literally anything.
It's bad enough that i have to fucking check the type of the passed variable, to make sure the user isn't giving me a function when i actually want a string.
>I have honestly never encountered data structures called maps or sets. What language are you coming from that has those?
Have you ever written anything ever? You constantly need data structures to do your shit.
>Array.sort()
Okay, i guess sorting an array is easy, What if i want a sorted map container that has logn insertions and logn removal?
I can't just sort the entire array after pushing the value, that's retarded.

>>52399162
Isn't that code example you gave valid for just one object instance called obj? I want to create an array of instances that have the same type and methods.
And what if i want to hide variables inside the object from the user? Everything is exposed automatically? Fuck that.
And don't even get me started on polymorphism which i'm guessing actually is literally impossible since the type system is so broken.
>>
>>52399156
because the patter is increment
1,0
0,2
1,0
2,0
etc

except on 7. You skip that one.

Duh.
>>
>>52399281
ES6:
class Foo {
constructor(bar) {
this._bar = bar;
}

get bar() {
return this._bar;
}
}


Otherwise:
function Foo(bar) {
this._foo = bar;

this.GetBar = function() {
return this._bar;
}
}
>>
File: surpriseattack.webm (739 KB, 720x404) Image search: [iqdb] [SauceNao] [Google]
surpriseattack.webm
739 KB, 720x404
Ask your beloved programming literate anything.
>>
>>52399340
See? This is fucking retarded.
You have to abuse the fact that variables can be functions in order to fake OOP.
Also figures a web dev would not know about data structures.
All you guys know is how to insert your shit in a database or a cache server, use libraries and copy-paste code.
>>
>>52399391
remember where you are..
>welcome to faggot_land
>>
>>52399281
>I don't see any objects anywhere.
I don't even understand the problem you're describing. Where would you expect to see them? What do you even mean by "see objects?" Like on MDN? Have you searched for "object?"

>check the type of the passed variable, to make sure the user isn't giving me a function when i actually want a string
Under no circumstances should you be letting your users evaluate arbitrary code. This is true in every language. I don't understand how it would be possible to run into this problem.

>You constantly need data structures to do your shit.
Yeah and in that time i've never heard of maps or sets specifically. I googled it and it sounds like they are only superficially different from Objects and Arrays.

>What if i want a sorted map container
Well there's no maps so I guess there's no answer to that.
>>
>>52399281
>I want to create an array of instances that have the same type and methods.
>And what if i want to hide variables inside the object from the user?
Now you're getting closer. To give the same type/methods to a group of objects we use prototypes in JS, which are in some sense kind of like classes in Java, but not really. The OOP in JS is only visually similar to Java on a surface level. To make private members in JS, we use closures.

Now, I'm not a huge fan of prototypes, but it's okay, I guess. JS's first class functions though are something Java really lacks.

>And don't even get me started on polymorphism which i'm guessing actually is literally impossible since the type system is so broken.
More or less right on the type system being broken, but polymorphism is everywhere in JS. Every function call is late binding, dude. (I wish late binding was optional though)

>>52399384
Why does addressing [ebp] in most conventional x86 instructions result in an additional null byte at the end of the instruction? I actually know the answer to this one, I'm just curious about how well you know assembly.

>>52399391
>fake OOP
Oh boy, we have a Java expert over here.
>>
>>52399441
import faggot
print "kill you're self"
>>
File: 1452448886287.png (248 KB, 413x695) Image search: [iqdb] [SauceNao] [Google]
1452448886287.png
248 KB, 413x695
>>52399162
>Could you give us more of the sequence?
Sure.

(1, 1) (2, 1) (1, 3) (2, 3) (1, 5) (2, 5) (1, 7) (1, 9) (2, 9) (2, 11) (1, 13) (2, 13) (1, 15) (1, 17) (1, 19) (2, 19) (2, 21) (1, 23)


Any ideas?
>>
>>52399474
>Python 2
>>
>>52399391
>insert your shit in a database or a cache server, use libraries and copy-paste code
This is actually great advice for pretty much every programmer.

That's literally all you have to do to get six-figure jobs.
>>
>>52399485
>being a jew
>>
>>52399281
Javascript is inherently insecure and there's nothing you can do about it. If you want code your users have no access too put it on your server. Period.
>>
>>52399474
You realized the battle was lost, I guess.

>>52399480
I'm not sure how to make sense of it.

I noticed it always counts up odd on the right, and it seems to always use consecutive numbers for the one on the left side, so I made a new sequence out of yours. In the new sequence, each tuple represents a single odd number on the right side - its left value is the minimum left-side value for that odd number, and its right value is the maximum left-side value for that odd number.

Does anyone see a pattern in this?
(1,2), (1,2), (1,2), (1,1), (1,2), (2,2), (1,2), (1,1), (1,1), (1,2), (2,2), (1,1)


>>52399535
What do you mean, insecure?
>>
File: seasonsgreetings.jpg (123 KB, 674x800) Image search: [iqdb] [SauceNao] [Google]
seasonsgreetings.jpg
123 KB, 674x800
Wrote a simple bash script to drop around my server.
When something happens, like someone logs in or a service crashes, one of my bots sends a timestamped notification to a private channel on Telegram.
>>
>>52399548
>What do you mean, insecure?
I mean everyone can have access to every part of your code from the dev console of the browser. All variables can be made public no matter their scope and any of it can be edited arbitrarily on the fly. You were asking about private variables in javascript and the answer is yes absolutely everything is exposed.
>>
>>52399439
I don't see objects like you'd see them in C++ or java/C#. Hell even C has structs and even python/php have classes.
In javascript you just have functions and variables.

>Under no circumstances should you be letting your users evaluate arbitrary code.
This is why i have to check what the client sends me. All i get is a variable that can contain anything. I need to check it actually is what i requested.
In a non-shit language when you expect a number, you literally just read 4 bytes from the network socket and store it in uint32_t.

>I googled it and it sounds like they are only superficially different from Objects and Arrays.
Oh boy. AVL trees. RB trees. Hash tables. Why do you think those exist if you can do the same with a simple array?

>Well there's no maps so I guess there's no answer to that.
Yes there is. "hurr just use a database/library for that"

>>52399441
>To make private members in JS, we use closures.
Oh yes because function inside a function inside a function inside a function is so readable.
I bet the memory explodes with closures. This is another thing you have no control of. Memory.
And how does the stack work with javascript?

Even python and php are better than javascript. And they are both exceptionally shit. But javascript takes it to another level.
>>
Eriri a shit.
>>
Euler or Gauss, /dpt/?
Also, Daily Prince of Mathematicians Thread in a Thread...
>>
>>52399732
Gauss tb᠎h
>>
>>52399624
What does any of that have to do with security?
>>
>>52399631
Now I feel like you're just being difficult because you want to believe it's javascript's fault you can't learn it.

Real classes are coming in ES6 until then there "Pseudo-Classical Instantiation" which is kinda hacky but mostly a result of people like you demanding javascript behave like java when it really isn't because they refuse to accept that something could be different than what they're used to.

>Oh boy. AVL trees. RB trees. Hash tables. Why do you think those exist if you can do the same with a simple array?
But they don't exist. You have to write them yourself. Except hash tables, that's just an object in javascript.

>hurr
We're done here. You can hate javascript and that's fine. This isn't your blog so if you come here I assume its because you actually want answers to your questions and not just to bitch about them. 5 posts ago you were bitching about there being no maps in JS and now "hurr yes there is." Literally no there isn't. If there were then what was your problem to begin with?
>>
>>52399624
That's not a valid argument. Javascript exposes the same information any other client-side application does simply through the virtue of using the memory of the computer you deployed it to.

Anyone who relies on security through obscurity of that fashion is doing it wrong.

>>52399631
>Oh yes because function inside a function inside a function inside a function is so readable.
It actually can be very readable when used correctly, especially since now we can do things like
let dist = (x, y) => Math.sqrt(x*x + y*y);


>I bet the memory explodes with closures.
It doesn't, actually, but it does end up moving stack memory onto the heap when functions are passed out of their parent function's scope, which makes some optimizations hard.
>This is another thing you have no control of. Memory.
What degree of control do you desire? JS has a similar degree of control over memory as Java does.
>And how does the stack work with javascript?
What exactly are you asking?
>>52399631
>Even python and php are better than javascript.
Python, maybe, PHP absolutely not.


In reply to your comment to someone else:
>I don't see objects like you'd see them in C++ or java/C#.
The typed object API will be available soon, which will allow us guaranteed memory efficient objects like you see in C.

However, V8 already detects and generates "invisible classes" when you create many similar objects such as {x: 3, y: 1} and only resorts to actual dictionaries when objects become really large (and thus actually represent dictionaries).
>>
Did anime win the /dpt/ war?
Also do people Take sublime text or do they buy it like they are Supposed to?
>>
>I don't see objects like you'd see them in C++ or java/C#.

JS objects are equivalent to Ruby hashes, Python dicts and PHP's associative arrays. Javascript is hardly unique in this regard.
>>
what's the best technology company to be a wageslave at?
>>
>>52399765
I guess i meant "unsafe" instead of "insecure." I don't know, I don't put a lot of thought into semantics.
>>
>>52399631
>In a non-shit language

<<MyNum:32, Rest/binary>> = Data.


Erlang master race :3
>>
>>52399787
Nobody has ever paid for sublime text. None of my professors, not even the people who interviewed me at google. Nobody. Not ever even once in the history of the entire world.
>>
File: 1443474486835.jpg (432 KB, 713x591) Image search: [iqdb] [SauceNao] [Google]
1443474486835.jpg
432 KB, 713x591
>>52398999

Hey /g/. I'm a weekend warrior webdev, just for fun. And recently I've started learning javascript, and I need some spoon feeding.

Why doesn't this work:

test1.onclick = function myFunction() {
if (document.getElementById("test1").style.color = "red")
{document.getElementById("test1").style.color = "blue";}

else {document.getElementById("test1").style.color = "red"}
}

It turns it blue, but when I click again it doesn't turn it back to red, why. When it finds the condition isn't true, since it's not red anymore, shouldn't it make it red again? The code gives no error in the console, I dunno what to do.
>>
>>52399871
I-I have a sublime text license
>>
>>52399889
Should be == in your if statement.
>>
>>52399889
= is used for assignment
== is used for comparison
>>
>>52399889
> if (document.getElementById("test1").style.color = "red")
"=" is assignment, use "==" for comparison.
>>
>>52399917
>>52399901

Many thanks.
>>
>>52399901
>>52399917
>>52399921
>using == ever
None of you should be giving advice.

>>52399889
Use "===" for comparisons. It doesn't do any type coercion and generally is going to avoid headaches in the future.
>>
>>52399480

Every time the X number increments past 2, the odd number, Y increments instead and the X number goes back to 1. Both times it skips the X increment between 5-7 and 15-17.

(1,1) >> (2,1)
(1,3) >> (2,3) and so on, skipping the 5-7 X increment

(1,5) >> (1,7) as you can see there is no 2 for the X and the Y just increments to the next odd number instead
>>
>>52399953
im not a javascript programmer faggot
>>
>>52399980
>this is the pattern except for when it isn't
???
>>
var Faggot = require('./Faggot');
new Faggot(3000).work();

works, when
new require('./Faggot')(3000).work();

doesn't
>>
>>52399985
yeah that was my point, what's yours?
>>
>>52399996
I mean skipping the X increment between 5 and 7 is part of the pattern. I dont know what you want from me
>>
>>52400041
Yeah and after? What else skips? God you're a fucking idiot
>>
>>52398999
What the fucks this chink cunt have to do with programming you virgin? Christ
>>
>>52400066
>virgin

Projecting much? I live with my boyfriend.
>>
>>52400065
You must be fucking blind. Let me explain

(1,1)
(2,1) first sequence of X incrementing to 2.
(1,3)
(2,3) second sequence of X incrementing to 2.
(1,5)
(2,5) third sequence of X incrementing to 2.

(1,7) >> (1,9) after three sequences of X incrementing to 2, it is skipped. That is the pattern.
>>
>>52400066
I don't understand why people are confused by this in every single thread. You'd have to have really fucking severe tunnel vision to not see that every single thread on this board has anime all over it and pretty much always has. You must just not know what site you are on.
>>
>>52400075
1/10 made me respond.
>>
>>52400115
i mean i guess there's nothing theoretically wrong with the pattern having 2 unrelated rules. I don't know.
>>
>>52400011
I also want to know the answer to this. That's confusing to me and I use node every day in my job.
>>
>>52400214
I don't think you can assume two different rules, I mean, maybe a pattern can follow more unrelated rules, but if you assume so rules could be found on every finite pattern, maybe infinite rules... That wouldn't make sense...
>>
>>52400289
Sorry, I reckon I can't express myself in perfida Albione's language
>>
>>52399953
>type coercion
Could you expand on that ? What is it and how is it a bad thing ?
>>
>>52400320
"0" == 0 => True
"0" === 0 => False
>>
>>52400320
> 0 == "0"
true
> 0 === "0"
false
>>
>>52399391
>You have to abuse the fact that variables can be functions in order to fake OOP.
This is actual OOP. http://xahlee.info/comp/oop.html
>>
>>52400330
What is the typical case where this could be a problem ? Please bear with me, I started JS two days ago.
>>
>>52400355
No seriously: how much sense does this article and Xah Lee in general do according to DPT?
>>
>>52400356
Certain test cases may work even if the code is fundamentally broken.
>>
>>52400356
function double(x) {
return x+x;
}


Although 5 == '5', double(5) is 10 and double('5') is '55'.
>>
>>52399391
>I have no exposure to OOP besides Java but Java is super duper OOP, so I know everything about what is and isn't OOP
>>
>>52400401
Alright thanks for the enlightenment
>>
>X does OOP better than Y
>because in X you have to use all this special boilerplate syntax to achieve the same thing that Y does with only variables and functions
>>
>>52400011
>>52400275
Operator precedence. `new` comes before function calls, so this happens:

(new require('./Faggot'))(3000).work();

`require` isn't a constructor, so that should fail.

You need to group the require call by itself like so:

new (require('./Faggot'))(3000).work();

That will call require before trying to instantiate its value.
>>
>>52398999
>What are you working on, /g/?
a programm to automate travel expense accounting for my company in C#. Would be fun if I didnt need to do Interopt with Word
>>
>>52400356
If i remember this right, im basing it off of java logic instead of JS logic. == compares the "pointers" in memory and === compares the actual values to see if they are equal.

Someone verify if this is correct?
>>
>>52400531
If there is a way to convert both operands to the same type, == will do so before comparing equality (which is why 0 == "0" is true). === checks for type equality and then value equality.
>>
>people willingly using javascript
I don't trust any language where
x + x == x * 2

can turn out to be false
>>
raw opengl masterrace
>>
>>52400573
OpenGL is not even that low level.

If Vulkan is C, OpenGL is Java.
>>
http://shdr.bkcore.com/
>>
>>52400585
is vulkan even out yet? and it won't get supported by mobile devices any time soon

>OpenGL is not even that low level.
which is what i'm saying. pisskiddies telling you to use engines/frameworks/libraries just because they're too afraid to learn how to roll their own graphics should kill themselves.
>>
>>52400567
So you don't trust C then?
>>
>>52400608
Not out yet.

Fair.
>>
>>52400567
so any language where you can overload operators?

class Foo:
def __add__(self, other):
return 4

def __mul__(self, other):
return 5

x = Foo()
print x + x == x * 2
>>
>>52400637
>>52400567
#BTFO
>>
>>52400567
> let x + y = putStrLn ":^)"
> 1 + 1
:^)
>>
>>52398999
I'm working on getting outputting a line to the cli, and updating that line every iteration of a loop. Yes, today's my first day programming.

Using \r works well enough, but when the new data is shorter than the old data, the end of the old output is left hanging around. So I tried using cout.flush() and now there's some weird hex there.
>>
>>52400066
She is actually a legendary programmer in the light novel and anime.
>>
>>52400637
he has a point though

operator overloading is like the least trustworthy thing. I don't get why people think it's acceptable.

Think if I renamed:
>screen.output(val)
to:
>screen.shift_left(val)
wouldn't make any sense, right?
and then ask why screen<<val is somehow ok
>>
>>52400778
okay then have fun using nothing but Java anon
>>
>>52400778
>I don't get why people think it's acceptable.

Look at some of the Java bignum stuff. It should start to make sense then.

I don't like it either, but it has its uses.
>>
File: 1452441537054.png (213 KB, 634x575) Image search: [iqdb] [SauceNao] [Google]
1452441537054.png
213 KB, 634x575
var array = [2, 3]; 

function asdfg(n) {
if(n % 2 != 0) {
var top = (2 + n * 3);
var kek = (4 + n * 3);

for(var i = 0; i < array.length; i++) {
if(top != null) {
if(top % array[i] == 0) {
top = null;
}
}

if(kek != null) {
if(kek % array[i] == 0) {
kek = null;
}
}
}

if(top != null) {
array.push(top);
}

if(kek != null) {
array.push(kek);
}
}
}

for(var i = 1; i <= 100000; i += 2) {
asdfg(i);
}

console.log(array);


is this an efficient/accurate way to generate a list of primes senpai? i came up with it all by myself :^)
>>
>>52400778
I don't see any problem if those instances make sense. For example, (*) could be any internal associative, binary operation (a semigroup) without any trouble. If you require more structure, just specify a Ring or Field constrain in your generic function.
>>
>>52400796
I use Python and C m8

I'm intending to learn C++ even though I dislike it because it's got massive support libraries and is pretty much the standard for desktop applications. It's shit but it is what's available.
>>
File: logo.png (6 KB, 200x200) Image search: [iqdb] [SauceNao] [Google]
logo.png
6 KB, 200x200
>>52398999

>>52400261
>>52400261
>>
>>52400854
no that's stupid

the only acceptable use case is in mathematical libraries as
>>52400815
rightly points out.

in any other case operator overloading is stupid. look at the strings in c++ for an example of this.
>>
>>52400880
We're nowhere near the bump limit yet.
>>
How do compositing window managers work? Is it all just rendered as one fullscreen opengl window?
>>
>>52401245
>What is google?
https://en.wikipedia.org/wiki/Compositing_window_manager
>>
Anyone here ever used the wikiMedia API with javascript?

This shit is hard to grok for a layman pleb like myself.
>>
>>52401288
You don't think I didn't read that before posting? It doesn't explain HOW they work in practice.
>>
Why are there two threads?

The image wars aren't starting again are they?
>>
>>52400769
Nope, she's a drawn fiction character for children.
The sooner you get that through your head the sooner you can start growing up into the adult you should have been when you turned 18.
>>
>>52401329
you're actually a stupid idiot
>>
>>52401329
Is that why you made a separate /dpt/ thread?

Because the image is an anime girl?
>>
>>52401339
I'm getting paid to be an idiot on a chinkforum, are you? No? Stay manchild.
>>
>>52401329
>why does that computer have an apple on it? apples are not computer related

The autism is strong with this one.
>>
>>52400637
python is also shit
>>
Thought I'd come in and say that I've been going through the thinkjava pdf nicely, but just spent a little over an hour trying to wrap my head around each recurse of the factorial example and the stack diagram didn't help much.

am i retarted

public static int factorial(int n) {
if (n == 0) {
return 1;
} else {
int recurse = factorial(n-1);
int result = n * recurse;
return result;
}
}
>>
>>52401405
>not tail recursive
Absolutely disgusting.
>>
File: 1452530965310.png (193 KB, 397x547) Image search: [iqdb] [SauceNao] [Google]
1452530965310.png
193 KB, 397x547
What meme language should I learn, /dpt/?
>>
>>52401441
C++
>>
>>52400778
operator overloading is used for shit like vectors and compound data types which can logically use addition/multiplication/etc

vec(1, 1, 1) + vec(2, 2, 2) is just simpler and easier to understand at a glance than Vector.add(vec(1, 1, 1), vec(2, 2, 2))
>>
>>52401441
nim
>>
CHALLENGE: Code a Haskell programm using Text.PrettyPrint.Boxes to print a skyline

here's my solution:
http://paste.debian.net/365571/

you can use everything till line 86: splitSkyline
>>
>>52401504
nim is based

>features of every other language combined
>more powerful than all other languages
>better performance than everything but ASM and hand written C
>>
>>52401405
I know it isn't Java, but this might help: http://learnyousomeerlang.com/recursion

It boils down to having a base case (in this case, factorial(0) = 1), and something which moves towards it (in this case factorial(n-1)).

You could write the Java function much more concisely as:
public static int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n-1);
}
}


Just try to expand the function calls as in the link I posted to help further.
>>
Ignore the trips, the code is at: >>52393000

>spend time setting up a dynamic array lua entity system in C
>seems to work pretty good
>add SDL to engine
>only notice one entity on screen
>moves extremely fast (as many times as that entity should be on the level, say, 5)
>console still tells me there are 5

I don't seem to be having any memory issues at the time being, but for all the entities to converge is weird.

I think I may have found the issue though, the tables inside the entity table. For some reason those values are the same across all entities while variables just in the entity table itself aren't. Is this something easily fixable?
>>
>>52400369
if you can't understand on a basic level what is happening in that article, you need to study more
>>
>>52401519
Extra Points for a solution of skyline that isn't my ass slow O(n^2)

Hint: O(n log n) should be the best
>>
>>52401367
>>52401351
weebshits on suicide watch
>>
>>52401519
Do I have to use Text.PrettyPrint.Boxes? I mean, I could do it in a few lines without so I'm guessing that's the challenge?
>>
>>52401489
i'm not saying operator overloading doesn't have its uses but is vec1.add(vec2) really that bad?

big nums and vectors are like your only arguments but for example GMP even does it like mpz_add (a, a, b);
>>
>>52401525
Cool, as long as it helps I'm good. Thanks for this.
>>
>>52401565
You have to use Text.PrettyPrint.Boxes, i made it so that people, get a feeling for (unknown/less used) API of the Text.PrettyPrint.Boxes module
>>
>>52401329
I never said she wasn't a cartoon drawing for kids but she still is a programmer.
>>
>>52401581
yes it is, especially
1) having to do it A LOT
2) the god damned brackets for a function call
you have to constantly go back and forth between the front and back of the expression to balance brackets
3) verbose as fuck
>>
>>52401324
If you can't understand what is a very well detailed layman's explanation, then you're simply not ready to process the information.
>>
>>52401640
How can a drawing be a programmer you fucking idiot
>>
>>52401633
I'll see what I can do then. By the way, your normalize function is just
nubBy ((==) `on` hNew)
>>
>>52401640
>She's a programmer

Has she got a GitHub account?

I didn't know fictional characters could code, would be nice to see what language she uses.
>>
>>52401697
Do you get this autistic about all characters?
>Harry Potter isn't a wizard he's fucking words on a page.
>Robocop isn't a cyborg he's a fucking photograph on celluloid
>Chip and Dale aren't Rescue Rangers they're fucking paintings on cels.

The character is a fucking programmer, dickweed. Pull your dick out of your belly button and stop being a fucking idiot.
>>
I have some experience making Minecraft mods in Java and NinjaTrader scripts in C#. Which one should I continue learning if I want to do something bigger? Are there any open source projects in Java or C# that I could contribute to? Everything seems to be in C++.
>>
>>52401732
Japs don't care about freedom.
>>
>>52401689
Apparently you're not ready to process ANY kind of information. I'm well aware of what it DOES, I'm asking how it WORKS. With that in mind, please point out to me exactly where on that page it explains how the compositing actually happens.
>>
>>52401792
>A compositing window manager is a window manager that provides applications with an off-screen buffer for each window. The window manager composites the window buffers into an image representing the screen and writes the result into the display memory.

Literally the first line. That's how it works. What part of that very clear explanation are you not understanding?

You asked a very broad question, and in return you get a very broad but accurate and correct answer.
>>
>>52401792
>One of the first systems with a compositing windowing system was the Commodore Amiga, released in 1985. Applications could first request a region of memory outside the current display region for use as bitmap. The Amiga windowing system would then use a series of bit blits using the system's hardware blitter to build a composite of these applications' bitmaps, along with buttons and sliders, in display memory, without requiring these applications to redraw any of their bitmaps.

You want any more than this, you're gonna have to look into a specific compositing window manager.
>>
>>52401815
The compositing part, i.e., "The window manager composites the window buffers into an image representing the screen and writes the result into the display memory."

How is this done in practice?
>>
>>52401739
>harry potter
fictional character
>robocop
robot cop.
>chip and dale
animated characters for kids
AND AT LEAST MY DICK REACHES MY BELLYBUTTON.
>>
>>52401739
>not living in a delusional fat japanophilic anime daydream where barely-clothed underaged girls are programmers and want to suck your filthy NEET dick makes that poster a fucking idiot

Check yourself into an asylum, weeb, before you kill your handler for not bringing you the "chicken tendies".
>>
>>52401850
However the specific window manager decides to do it.

The broad strokes of how it is done in practice is is the explanation I gave you, if you're looking for a specific example then go look for one, I'm not spoonfeeding you.
>>
>>52401924
>if you're looking for a specific example then go look for one
Why do you think I'm posting here? If someone did happen to know it would be a lot quicker than wading through thousands of lines of code.

>I'm not spoonfeeding you.
In other words you don't know? It should have been obvious from my original post I was looking for specific details, there was no reason to reply with a passive aggressive link to the first result you found on google.
>>
daily """"""""""""""""""""""""""""""""""""""""programming""""""""""""""""""""""""""""""""""""""""
thread
>>
>>52402010
good job
>>
>>52402023
Don't ever fucking reply to me again unless you're contributing to this repo.
>>
>>52401850
With modern OpenGL you'd use FBOs and render each window to a texture then render those onto the main framebuffer where you can apply effects like blending, transparency, shadows, etc.
>>
>>52402041

You're right. That was a great contribution. Proud of you :^)
>>
>>52402041
git init
git add .
git commit -m 'fuck this repo'

git remote add origin https://www.4chan.org/
git push --force --set-upstream origin master
>>
>>52402059
That's what I figured, thanks.
>>
>>52401854
This is all true, but if you try to tell somebody Harry Potter is not a wizard because he isn't real, they're going to treat you like the maladjusted neckbeard you try not to present as.
>>52401855
No, being an neo-autistic fuck makes him an idiot. I don't even know who the fuck that character is but if the character is a programmer, then the character is a programmer. OBVIOUSLY they're not a LITERAL programmer, but nobody is that fucking stupid in real life. Again, you have a conversation with anybody about a fictional character and pull that crap.

>"Did you see Flash? Man, I love it when they show him being a forensic scientist! He's great at it!
>"Well...he's not a forensic scientist. He's a fictional character in a show"

Be a pedant for the rest of your life, fool.
>>
>>52402196
>pedant
This is my new favourite word, thank you.
>>
>>52401988
They use a graphics API (DirectX, OpenGL, etc.) to draw the windows from memory.

Do you want me to write the fucking code for you or something?

I don't know what you're expecting when you ask such a broad question, if you want to know how I'd do it, then I'd probably do what Compiz does and use OpenGL to draw windows onto texture objects using texture_from_pixmap.

I'm done responding to you now, because you're clearly expecting to be spoonfed, if you're incapable of what is literally 2 minutes on Google, then you have absolutely no chance of ever creating a compositing window manager.
>>
>>52402210
go out and be the semant you were meant to be
>>
>>52402230
At least I can go out, and interact with society without getting mad as shit whenever someone says "I could care less".
>>
>>52402196
>stupid in real life
Nah maybe not, unless I met one of the people which frequent these threads who are all
>muh 3dpd scum
>muh animu
>muh waifu
>muh data struggers
>muh agawidims

also I don't have a ne-- actually fuck I kind of do but it's more of just scruff. Just bustin' your balls anyway.

--Robocop
>>
>>52402296
Are you saying those people could care less?
>>
>>52402309
>muh data struggers
>muh agawidims
Those are important and relevant though
>>
>>52402309
>mein data struggles
>>
>>52402041
or else what
>>
>>52402296
*couldn't, you massive prancing la la homo man
>>
>>52398999
>all programmer humor is cringeworthy and throughly awful
is that software engineering manga any good?
it seems to sidestep the the usual programming cliches by portraying pair programming as erotic
>>
>>52402376
>implying any modern country has free speech
I'll call the police.
>>
>>52402401
How is that sidestepping anything?

Pairgramming has always been erotic. It creates erections in the straightest of men.
>>
>>52402393
They mean the same thing though
>>
>>52401581
> is vec1.add(vec2) really that bad?
On it's own, it's tolerable. Now extend it to
m1.multiply(v1).add(m2.multiply(v2)).add(m3.multiply(v3))

versus
m1*v1 + m2*v2 + m3*v3


> big nums and vectors are like your only arguments
It applies to any algebraic type. Bignums, rationals, complex numbers (in languages where those aren't a primitive type), matrices, vectors, quaternions, finite (Galois) fields, expressions-as-values (e.g. for symbolic differentiation), etc.

If you're writing CRUD code to spit out a web page, operator overloading probably isn't useful. If you're working with algebraic domains, it matters. There have been a couple of times that I've used Haskell solely for the ability to define infix operators (with control over precedence and associativity).

> but for example GMP even does it like
GMP uses a C API, so operator overloading isn't available. Nobody uses function-call syntax for this out of choice.
>>
>>52402309
I've never met anyone that bad. They generally don't integrate into society, at all.

>>52402332
I'm saying that they probably couldn't, but it's common for people to use the information-sparse version of the phrase as either shorthand, out of laziness, or ignorance. Whichever the reason is though, I don't get mad about it like >>52402393 is pretending to be. Cause I'm not an insufferable pedant.
>>
>>52402429
No, they don't.

>could not care less
I can't care any less than I already do, there for I care a very small amount, or not at all.
>could care less
I could care less than what I'm caring right now, which implies that I care somewhat, although it's likely that I'm not very intelligent and meant to type 'couldn't' or 'could not'.
>>
>>52401525
public static int factorial(int n) {
return (n == 0) ? 1 : n * factorial(n-1);
}
>>
>>52402106
Why doesn't /g/ have it's own built-in git host?
It'd make collaborative /g/ projects easy as fuck because it lowers the bar of entry to zero.

People who are afraid of attaching their name to a 4chan project can just contribute using a secure tripcode instead of a name.
>>
File: your-code.png (1 MB, 979x789) Image search: [iqdb] [SauceNao] [Google]
your-code.png
1 MB, 979x789
>>52402401
It's kind of garbage except for this guy.
>>
>>52402453
I understand that, but in colloquial English they can be used interchangeably
>>
>>52402476
Because people would fuck it up royally.

One person would have to administer the repo and divvy out access based on senority/skill/length of time without being an asshat.

Even then, the admin could fuck it up whenever and they'd have to constantly examine commits for tomfoolery.
>>
>>52402476
hellow newfag

https://gitgud.io/users/sign_in
>>
>>52402447
anon hasklel isn't the only language that lets you define custom infix operators
>>
>>52402504
In casual conversation, but typically if I see someone actually type that, it indicates a lower level of attention to detail and general intelligence.

Also, my autism makes me call it out.

My main issue is that it's used colloquially incorrectly out of sheer ignorance.
>>
>>52402515
what if you just give everyone push access?
>>
>>52402504
no they can't
in America they can be used interchangeably

anywhere else and people will think you're fucking stupid

rightfully so
>>
>>52400778
>operator overloading is like the least trustworthy thing. I don't get why people think it's acceptable.

what's the difference between a + b and a.plus(b) ? in both case you need to know the semantics of +
or plus()

'+' is nothing more than a symbol and the operator + is nothing more than a binary function except operators have an implicit order of operations.
>>
>>52402536
>>52402576
Eh, I gotta disagree. With the way language works, people will use things incorrectly to the point that they become correct, I wouldn't say it's a sign of lower intelligence. It's just a part of how languages change over time.
>>
>>52402597
a + b and a.plus(b)
both just call a function
>>
>>52402603
If you use that phrase erroneously, or any other mistake from ignorance such as the word 'irregardless', you will be looked down on by most educated peers.

This could be especially detrimental in a situation like a business meeting.
>>
>>52401729
>skyline
oh ok
>>
>>52402597
>what's wrong with a.add(b)
are you a java programmer by any chance

>operator overloading is shit and makes code harder to read
>>it doesn't
>who needs operator overloading? just use a.plus(b)
>>java add operator overloading
>oh yeah operator overloading is really cool let me show you what you can now do with Java
>>
>>52402603
>dumb people dumbing down the language
this is what happens when you let idiots define dictionary words and not a qualified council of scholars that curate the official implementation of your country's language
>>
>>52402644
whoops, meant to reply to someone else
guess that teaches me never to fucking reply to you again unless i'm contributing to the thread
>>
>>52402603
>Eh. I gotta disagree.

>This is considered English in America
I thought immigrants had to learn the language, what gives?
>>
>>52402674
The US doesn't have an official language.
>>
>>52402683
>TIL

That's interesting.
>>
>>52402683
english is the official language in 27 states

the rest publish all their government documents in english, spanish, french and 8 other asian languages
>>
>>52402633
That would be talking about the level of formality then, I'm sure you would talk less formally with your friends than with your boss?
>>52402651
Got along fine without those for a few thousand years.
>>52402674
I'm a native speaker
>>
>>52402683
'The' ""U""S"" "doesn't" 'have' "an" ""official"" '''language'''

wink wink frob frob
>>
>>52402736
>native speaker
top kek that's not english m8 that's tribal oboobogo language
>>
>>52402736
>I'm sure you would talk less formally with your friends
Sure, I use more slang and expletives, but I don't say words and phrases that are simply wrong out of ignorance.
>>
>>52402447
>On it's own, it's tolerable. Now extend it to
>m1.multiply(v1).add(m2.multiply(v2)).add(m3.multiply(v3))
You don't have to write it completely illegible.
a = mul(m1, v1)
b = mul(m2, v2)
c = mul(m3, v3)
s = add(a, b)
s = add(s, c)

writing it like that could even be preferable over operator overloading when it comes to analyzing performance or number of operations.
>>
File: 1233255977804.jpg (23 KB, 414x425) Image search: [iqdb] [SauceNao] [Google]
1233255977804.jpg
23 KB, 414x425
>>52401441
/s4s/-speak.
>>
How do I implement a git host?
>>
>>52402504
people can tolerate it without nitpicking like a sperglord but they will view you as a fucking idiot
>>
-=----------=- [ RULES ] -=----------=-
1) No black people fuck off back to reddit
2) No faggots
3) No Window shills
4) No one who eats shit out off their hands
5) Leave it in Vim mode
6) never delete the rules.
7) We dont speak of the rules. or fight club.
8) weebshits not allowed either.
9) Dont delete other people's shit
A) Embrace the hexidecimal
B) No traps, fuck off back to /b/
C) No allowed, dont even think about it.
D) NO JEWS ALLOWED.
E) NO CURRY NIGGERS ALLOWED, THIS MEANS YOU PAJEET

-=----------=- [ LIST OF APPROVED LANGUAGES ] -=----------=-
1) C
2) C again
4) Perl (5)


-=----------=- [ C AREA ] -=----------=-
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] ) {
while(1){
int *g = malloc(MAX_INT**MAX_INT); // leak all the memeory
printf("%p\n", g);
}
return 0;
}


-=----------=- [ PERL AREA ] -=----------=-
#!/bin/perl
use warnings;
use strict;

print ":3\n";
print "C is better";

hi
>>
Complaining about operator overloading but being perfectly okay with regular function/method overloading is retarded. They're the same god damn thing.
>>
vector.insert(vector.begin() + 0, myObject);


This will insert myObject to the beginning of the vector, right?
>>
>>52402888
Code Monkey: The Post.
>>
Procedures are fucking retarded

If you use procedures/functions you're a shit programmer
>>
>>52402914
No argument: the post.
>>
>>52402888
it is not strictly necessary to have both. a benefit of not having operator overloading in a language is that you will always know what an operator does regardless of which codebase you are looking at and in which context.
>>
>>52402749
Ok
>>52402755
The problem here is that it's such a gray area on how formal a phrase is. I'd agree that the usage is incorrect, but how many people would notice and care?
>>
>>52402923
And why does that matter for operators if it doesn't apply to named functions or methods?
>>
>>52402932
>how many people would notice and care?
your own ignorance doesn't mean you should say it and just because people don't spergrage over it doesn't mean they don't notice and care. just fucking don't say "i could care less" like a moron.
>>
>>52402948
fucking idiot i'm not going to waste my time debating this with you

this """"""""argument"""""""" is pretty much pointless unless you're a language designer anyway
>>
>>52402832
> int *g = malloc(MAX_INT**MAX_INT); // leak all the memeory

ok i laughed
>>
>>52399069

it started something like
a=1;
b=1;
repeat
a+=1;
b+=a;
a=1;
until ---;

[\code]

but it went off at the 9
>>
>>52402913
You want std::deque if you want to be inserting to the beginning a lot
>>
>>52402973
>I have no actual points against it but muh favourite language Java doesn't have it therefore it's SHIT!!!!
>>
/dpt/ PROBLEM TIME

go solve this simple prime numbers now
https://dmoj.ca/problem/vmss7wc16c1p1
>>
>>52402988
k tard

look up previous posts on this subject in the archives if you genuinely want my views on it and aren't just here to """"""""debate"""""""" ad infinitum with your stubborn sperg nitpicking that doesn't even matter

also i primarily use C++ but i don't even use operator overloading because i don't need to
>>
>>52402832
>2) No faggots

Computer science and programming is a field in which homossexuals excel. You will never know what it's like to be a gay programmer, you fucking breeder.
>>
>read book on algorithms
>I find that the subtlety of depth-first search-based algorithms kicks me in the head whenever I try to implement one.
>oh boy this section is going to be great
>author proceeds to fuck up pseudo code for finding cycles in a graph
I wasted half an hour of my life figuring out what was wrong about my thought process until I finally looked it up and found out he made a mistake. What a faggot.
>>
>>52403007
>Could not find a problem with the code "vmss7wc16c1p1".
>>
prime fizzbuzz time

write a program that, for each number in 1 to 100:
if it is prime and a multiple of 3 and 5, outputs "fizzbuzz"
if it is prime and a multiple of 3 and not 5, outputs "fizz"
if it is prime and a multiple of 5 and not 3, outputs "buzz"
otherwise outputs the number
>>
>>52402963
And how do you know how many do notice and care?
>>
>>52402832
>8) weebshits not allowed either.
/dpt/ would die.
>>
>>52403043
>/g/ is nothing but 4chan thread downloaders and fizzbuzz

I really need to get away from this place.
>>
>>52403043
print 1
print 2
print "Fizz"
print 4
print "Buzz"
for i in [6..100]:
print i
>>
meme fizzbuzz time

write a program that, for each number in 1 to 100:
if this meme is gay, outputs "fuck this thread"
>>
>>52403078
for i in 1..100
printf "%i" i
>>
>>52402985
I'm only doing it once; I know it's kinda slow but I don't want to have to rewrite a shitload of code just for a slight load time boost.
>>
>>52403046
it doesn't even matter how many they are. it's like always saying "innan" ("before") in swedish when there are plenty of times you should be saying "före", "förut", "tidigare". a lot of the people saying it aren't even aware that they're doing it but they look like uneducated imbeciles to those who are aware of it. saying "i could care less" implies that you've misheard "i couldn't care less" and that you lack a true understanding of the phrase.
>>
>>52403095
wrong.
i never specified what to output if the meme is not gay. you fail retard, go back to meme class.
>>
File: 1452446496816.png (616 KB, 895x892) Image search: [iqdb] [SauceNao] [Google]
1452446496816.png
616 KB, 895x892
>>52403066
You might like Reddit, anon.
>>
File: dpt fails again.png (37 KB, 743x610) Image search: [iqdb] [SauceNao] [Google]
dpt fails again.png
37 KB, 743x610
>>52403106
you didn't specify
so how am i wrong

;)?
>>
>>52403113
(filename related)
>>
>>52401729
anon how far are you?
>>
>>52403113
>if i hit an unspecified case, i can just do what i want
sure, anon
>>
I know C and enough OO to implement OO features in C.
How much javascript do I need to learn before I can write userscripts?
As I understand it, the only real difference between C-likes and javascript is the dynamic typing and the type coercion thing with == and ===.
>>
>>52402215
Aren't you just a prickly little insecure asshole
>>
>>52403147
underrated
>>
>>52403144
that's literally true
i satisfied all conditions

similarly you can't say "i never asked you to comment your code" and fail someone for commenting their code

silly anon
>>
>>52403113
You didn't implement his program correctly, just accept it. Even if the meme wasn't gay (which it is), it should just do nothing instead of printing the numbers. You misinterpreted the program and therefor fail the challenge.
>>
>>52403144
yes you can

if the spec leaves out crucial information then either the spec itself is flawed (not your program) or it has intentionally been left open to interpretation
>>
File: 1452442376609.png (154 KB, 334x555) Image search: [iqdb] [SauceNao] [Google]
1452442376609.png
154 KB, 334x555
Quick, press F12, go to console and paste this in:

var t = document.getElementsByClassName("thread")[0].id;
var p = localStorage["4chan-track-g-" + t.substring(1)];
var b = document.getElementsByClassName("bottomCtrl")[0];
var lp = p.split(">>");
lp = lp[lp.length - 1];
lp = lp.substring(0, t.length - 1);
b = b.getElementsByTagName("input");
document.getElementById("p" + lp).getElementsByClassName("desktop")[0].childNodes[0].checked = true;
b[4].click()
>>
>>52403078

>this is what /dpt/ is actually arguing about right now
>>
>>52403177
does this delete all my posts or something?
>>
File: CONDUCTOR.gif (301 KB, 136x240) Image search: [iqdb] [SauceNao] [Google]
CONDUCTOR.gif
301 KB, 136x240
>>52403177
>javascript
>>
>>52403163
>>52403167
Incorrect. See >>52403164
>>
>>52403177
Never before has any one dared utter the words of that tongue here in /dpt/
>>
File: ijj.jpg (68 KB, 1280x720) Image search: [iqdb] [SauceNao] [Google]
ijj.jpg
68 KB, 1280x720
>>52403200
>yfw you realise you're running JavaScript right now
>>
>>52403300
I'm not, my browser is. Get some education, dumb anime poster.
>>
>>52403177
anon, why are you trying to delete all my posts?
>>
>>52403104
It is relevant how many people notice though. In your example, it could get to the point where Swedes are always using innan and the other words are phased out of the language, it's just a part of how languages change. "Whom" is technically correct English, and older people will chastise you for not using it, but for the most part that is dying out and people are always using who instead of whom.
>>
>>52403324
You are running JavaScript, in your browser.
>>
>>52403300
That's not true. That's impossible!
>>
>>52403343
I'm not. I'm using a computer who is running a browser who is running the JavaScript for me.
>>
>>52403343
fuck off weeb
>>
>>52403332
the thing is that "i could care less" literally means the opposite of "i couldn't care less". "i could care less" is just so fucking wrong that it should be out of the question to use it if you are aware that you could say "i couldn't care less" instead.
>>
>>52403379
well the "opposite extreme" would really be "i couldn't care more" but the "logical negation" would be "i could care less"
>>
>>52403379
this
it's like when people say "everything but x" to mean "x"
>>
>>52403379
Idioms man, I can't explain them
>>
>>52403424
Idiots*

Idioms have meaning
>>
>>52403445
That are different from their literal meaning
>>
if ((grid[0] == mark && grid[1] == mark && grid[2] == mark) || 
(grid[0] == mark && grid[3] == mark && grid[6] == mark) ||
(grid[0] == mark && grid[4] == mark && grid[8] == mark) ||
(grid[1] == mark && grid[4] == mark && grid[7] == mark) ||
(grid[2] == mark && grid[5] == mark && grid[8] == mark) ||
(grid[6] == mark && grid[4] == mark && grid[2] == mark))
{


checks for the winner of tictactoe
1) should i do this kinda thing?
2) how can i approach it differently?
>>
>>52403466
idioms usually make sense

"i could care less" is just retarded
>>
>>52403514
Does kicking the bucket make sense for dying?
>>
>>52403490
What do YOU think? Is it maintainable and readable?
>>
If you have ever said "I could care less" and unironically meant it to mean "I couldn't care less" you should literally kill yourself.
>>
>>52403490
Just do this as 3 separate function
unsigned hori = isvalid_hori(grid);
unsigned vert = isvalid_vert(grid);
unsigned diag = isvalid_diag(grid);
return (hori && vert && diag);
>>
>>52403529
>what is etymology
>>
>>52403529
it's fine and it might have a great etymological explanation

"not dying" would be a really dumb thing to say if you meant dying
>>
>>52403490
Maybe you could replace that huge with a "win condition" flag, and move the logic of whether that win condition is true or not to the piece of code where you actually play (meaning that every time someone puts a mark down, you check if it's a winning move).
>>
>>52403553
What language is this?
>>
>>52403535
If you have ever said "the exception that proves the rule" on something that actually contradicts the rule, you should kill yourself.
>>
>>52403535
Naw
>>
>>52403592
C
>>
>>52403592
C

here's a better solution
int hori = grid.validateHori(grid, grid.N(grid));
int vert = grid.validateVert(grid, grid.N(grid));
int diag = grid.validateDiag(grid, grid.N(grid));
return (hori && vert && diag);
>>
>>52403614
return grid.validateHori(grid, grid.N(grid)) &&
grid.validateVert(grid, grid.N(grid)) &&
grid.validateDiag(grid, grid.N(grid));
>>
>>52403599
that's something only a normie would say
>>
>>52403647
i don't like multi-line single declarations.
>>
>>52403655
get used to it
>>
>>52403655
yeah well nobody likes you faggot.
>>
>>52403490
>he can't see the one line fold zip zip & fold
>>
>>52403490
just check from where you put the last x/o.
>>
>>52403668
>>52403677
I'm not going to write declarations longer than 80 characters.
if you're doing this shit unironically you need to refactor.
>>
File: 1452124387781.jpg (40 KB, 574x574) Image search: [iqdb] [SauceNao] [Google]
1452124387781.jpg
40 KB, 574x574
JavaScript is fun!

var triangle = function(str, n) {
var val = "<br>";

if(n === undefined) {
n = str.length;
}

for(var i = 1; i <= n; i++){
val += "&nbsp;".repeat(n-i) + str.repeat(i * 2 - 1).substring(0, i * 2 - 1) + "<br>";
}

return val;
}


for(var i = 0; i < document.getElementsByClassName("postMessage").length; i++) {
var text = document.getElementsByClassName("postMessage")[i].textContent;
document.getElementsByClassName("postMessage")[i].innerHTML = "<code>" + triangle(text, 40); "</code>"
}


Post this in console, /dpt/. No tricks this time, I promise.
>>
>>52403700
the intent in >>52403647 is readable and clear
>>
>>52403690
Enlighten us
>>
>>52403690
what?
>>
>>52403701
It turned all the posts into meme triangles.

REEEEEEEEEEEEEEEEE
>>
>>52403722
At least align them if you insist on putting everything in 1 declaration.
return (grid.validateHori(grid, grid.N(grid)) && \
grid.validateVert(grid, grid.N(grid)) && \
grid.validateDiag(grid, grid.N(grid)));
>>
>>52403761
)))))

fuck off lispfag
>>
>>52403701
><code></code>
i want weebshit js niggers to leave
>>
>>52403701
Ayyy
Nice one.
>>
>>52403761
>>52403614
>>52403647
should I be putting member functions in c structs?
or is that wasteful?
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [iqdb] [SauceNao] [Google]
1451751832808.png
17 KB, 418x359
>>52403043
>prime
>and a multiple of 3 and 5
sizable kek
>>
>>52403761
i prefer a double tab indentation for successive lines. for alignment you could have the return on the first line and everything else on double indent below the return line.
>>
>>52399480
>>52399480

More please
>>
Couldn't find web dev thread but I just took a front end job for 18 an hour. Junior position. Did I get cucked in terms of pay?
>>
>>52403851
the standard is 49 here
>>
>>52403851
>>52403851
The hardest part is getting your foot in the door, you can worry about getting better pay later.
>>
>>52400356

Don't think about why it could cause problems, just know that it could. So, with that in mind, only use ===

Unless you REALLY have a reason as to why. It's like using Static methods in C#
>>
>>52403126
Not him, but I think this is O(n log n)

http://pastebin.com/h1QXRkqV

Next I'll try to render it using Boxes
>>
NEW THREAD!

>>52403910
>>
>>52403869
>>52403869
>>52403869
>>52403869

NEW
>>
File: 1451937787603.jpg (44 KB, 640x640) Image search: [iqdb] [SauceNao] [Google]
1451937787603.jpg
44 KB, 640x640
>>52403043
>if it is prime and a multiple of 3 and 5

laughed more than i should
>>
>>52403912
>>52403916
d'awww
>>
>>52403908
Fucking pastebin

http://lpaste.net/1074610940697116672
>>
>>52403916
too late faggot
>>
>>52403912
>>52403916
>both anime pics
What a dilemma. How am I supposed to pick one?
>>
>>52400011

Isn't it:

var faggot = new require('./Faggot')(3000).work();
>>
>>52403912
Sorry anon, you were too late
>>
>>52403916
>>52403916
>>52403916
>>52403938
Whoever posts their link in the old thread first is the winner.
>>
>>52403869
>>52403869
>>52403869
>>52403869

Earliest thread.
>>
>>52403912
>>52403916
You're both late.

ACTUAL NEW THREAD*:

>>52400261
>>52400261
>>52400261

*Validated as being legitimate according to the 2016 /dpt/ newfag conventions by not having been deleted before this thread hit the bump limit.
>>
>>52403996
Fuck off normie.
>>
>>52403955
See >>52400880
>>
>>52403931
>http://lpaste.net/1074610940697116672

looks nice, if you still want to post the rendering, post it in the new thread
>>
>>52403701
*slow clap*
>>
>get good idea for project
>look online
>it already exists
Thread replies: 328
Thread images: 24
Thread DB ID: 404680



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

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.