« first day (1776 days earlier)      last day (3187 days later) » 

2:00 PM
you can use Array.filter(function(arrayItem) { }); to filter the array down
but you are not at all clear on your requirements for what should be filtered.
 
@rlemon wait, is that a question?
 
-3
Q: Array of numbers addition in all possible ways in java script

TejaI have an array(for example: array["1","2","4","8","16","32"]) Now i want to get sum of these numbers in an array in all possible ways. for example:[(1),(1+2),(1+2+3),(1+2+4),(1+2+8)......(1+2+4+8+16+32)]. Please tell me some function which performs this operation..

 
I have an entry <Route name="creatememento" path="/create" handler={MementoCreate}> when I visit localhost:3000 and click on /create then it redirects to create coz its a Link to="creatememento" but when the page reloads it says cannot get /create . how to overcome this and point to the MementoCreate.react.jsx
 
user3119231
@Cerbrus Is possible to create 2 canvas? Need to create the top triangle at bottom.
 
user3119231
	canvas: function(){
		canvas = document.createElement("canvas");
		canvas.height = window.innerHeight;
		canvas.width = window.innerWidth;
		ctx = canvas.getContext("2d");
		ctx.beginPath();
		ctx.moveTo(0, 0);
		ctx.lineTo(window.innerWidth, 0);
		ctx.lineTo(0, 100);
		ctx.fillStyle = this.controlC2;
		ctx.fill();
		this.parent.appendChild(canvas);

		canvas = document.createElement("canvas");
		canvas.height = window.innerHeight;
		canvas.width = window.innerWidth;
		ctx = canvas.getContext("2d");
 
2:07 PM
0
Q: UPDATE with SELECT statement but re-select on each update

Ben FortuneI'm trying to update multiple rows in MySQL by selecting the highest number and adding 1 to it to generate the next one. UPDATE orders SET delivery_number = ( SELECT new_number FROM ( SELECT ( MAX(delivery_number) + 1 ) AS new_number FROM order_invoice ) AS re...

vamp pls
 
user3119231
just forget the code above. Just found out how lineTo works
 
is this even possible guys or should I just delete the question? stackoverflow.com/questions/32237125/…
 
Everything is possible
if you just believe
 
!!youtube if you believe
 
how does this make any sense? my ssh continues to drop randomly (sometimes it is bad, I cannot stay connected for more than 30 seconds) -- HOWEVER if I connect to a VPN the problem goes away
if my ISP is giving me a dodgy connection, wouldn't that persist even behind a vpn?
 
Blocking upload traffic?
 
@CapricaSix not bad though
 
my stomach ulcer has been kicking my butt lately... one of these days I'll go to the doctor...
 
user3119231
		path = [[[window.innerWidth, 0], [100, 100]],[[0, window.innerHeight], [100, 100]]];
		for (var i = 0; i < path.length; i++){
			canvas = document.createElement("canvas");
			canvas.height = window.innerHeight;
			canvas.width = window.innerWidth;
			ctx = canvas.getContext("2d");
			ctx.beginPath();
			ctx.moveTo(0, 0);
			for (var v = 0; v < path[i].length; v++){
				ctx.lineTo(path[i][v]);
			}
			ctx.fillStyle = this.controlC2;
			ctx.fill();
			this.parent.appendChild(canvas);
		}
 
2:26 PM
@Nick one of these days you won't
 
user3119231
Not enough arguments to CanvasRenderingContext2D.lineTo.
 
user3119231
What. the. fuck? I mean console.log works fine.
 
@Maurize perhaps it wants two numbers rather than an array of two numbers?
 
console.log takes different arguments than lineTo
 
user3119231
@JanDvorak perhaps you are very good.
 
2:28 PM
@Maurize verily a pain in the ass when implemented like that too..
either both shoudl be accepted or only array imho
 
YIL ++i is significantly faster than i++
 
user3119231
@Neil yeah :D
 
coordinates should go hand in hand.. it's one parameter not two
 
@JanDvorak I don't think I'm gonna die from an ulcer
 
@catgocat No no no no no no no no no no no no no no no no
 
2:29 PM
wait let me go get the book
 
@Nick I know you don't
@catgocat go get the book and throw it out the window
 
it makes sense though
 
no.
 
Tomorrow you'll learn about compiler optimizations
 
2:31 PM
@catgocat Because mov eax, v; inc v is significantly slower than inc v; mov eax, v?
 
let me find it among these 1000 pages
there it is suckers
 
@catgocat I heard about that too actually
 
Is it good idea to implement middleware? stackoverflow.com/questions/32251809/…
 
!!^
 
2:34 PM
@copy what about that huh??
me: 1 copy: 0
 
that said, seems like a microoptimization thing
 
6 mins ago, by catgocat
YIL ++i is significantly faster than i++
 
@rlemon I get this problem with torrents. My ISP randomly drops packets when it identifies it as P2P
 
That's what you wrote
 
@catgocat I swear I'm gonna kick you
 
2:35 PM
@copy yeah
 
But if I use a VPN, they can't detect it
 
It's still wrong, read your book correctly
 
@copy it says that the prefix avoids unnecessary work
and to only use postfix when necessary
 
@BenFortune my connection is two ISP's :P bridged
so I think that is causing ssh to fuck up
 
@rlemon Are you using QOS?
 
2:36 PM
The postfix operator must store the original value so
that it can return the unincremented value as its result. If we don’t need the
unincremented value, there’s no need for the extra work done by the postfix
operator.
 
We have 2 lines coming in here too
 
no
we have two lines because both only get 5mbits down and .3mbits up
 
Lucky you, I'm on 1/1
 
user1596138
At my old job we had two 10down 1.5up lines bridged
 
0.5 each
 
2:38 PM
@catgocat It's not significantly faster
 
@copy but it avoid unnecessary work therefore it's faster?
 
user1596138
Also I came to work and my chair is gone.
 
It may be manginally faster in some cases
 
LMAO
 
user1596138
So that threw me off a bit
 
2:38 PM
@Loktar playing pranks?
 
@catgocat Only if it's not optimized away
 
user1596138
He says he doesn't know who it was heh
 
I can just imagine it is in the back of his truck.
 
user1596138
Hahahahahaha
 
@rlemon haha that would be funny
 
2:39 PM
@copy which is not always the case
 
I don't at work though :/
 
Let me print giant "microoptimisation" on a baseball and find where @catgocat lives
 
user1596138
There's only like 20 extras laying around...
 
I act a lot different at work. Im a lame-o here.
 
:(
 
2:40 PM
"for more ... the extra work might be more costly"
 
Woo
 
user1596138
Biggest prank since I got here was writing :rebecca: on his wihteboard while he was on vacation..
 
user1596138
But I should've written :rebecca-black-friday: cause dampness
 
user1596138
Dammit I only have one joke right now and it sucks ass
 
@catgocat premature optimisation is the root of all evil. Nuff said.
 
2:42 PM
input.addEventListener('keyup', function() {
  if( Math.random()<0.9 ) return;
  this.selectionStart = this.selectionEnd = Math.random()*this.value.length|0;
});
trolololol
 
@JanDvorak Joking though, and that text is about C++. But maybe the optimizations might not cause the postfix version to have a slower performance.
Although there might be some cases where the compiler doesn't do these microoptimizations.
 
@copy I don't see how it is any faster at all. why does the compiler have to store the original value in a temporary variable?
 
But this is just me guessing.
 
user1596138
Found my chair in case anyone's wondering haha
 
2:45 PM
@AwalGarg Exactly the point (only if you write b = a++)
 
@copy even in that case, why does it have to store the original value in a temporary variable?
 
buh... can you add extra arguments to a callback? Eg, if on('data', func) passes data to func, can you also pass another scoped variable?
 
@AwalGarg It doesn't have to if it's optimizing enough.
 
@corvid bind
 
No optimizations in place. just inc and mov assembly operations. I still can't see any need of a temporary place to keep the variable.
 
2:47 PM
Doesn't that just apply a this arg though?
 
!!tell corvid mdn bind
 
user1596138
@rlemon How long does it take for that to actually happen
 
Hey there.
Are you arguing about postfix vs prefix looping? :D
I thought I was the only one caring.
 
We're not. Cat is.
 
user1596138
2:49 PM
@rlemon because !Math.random()<0.9 is not going to be very often lol
 
Haha, ok.
 
@Jhoopins that's the joke
 
Neither me. I am arguing against the book's claim of the requirement of a temporary variable. I can't see why it would need a temporary variable, even if there isn't any optimization.
 
Ah okay I didn't know that, thanks @BenFortune
 
1 message moved to Trash can
@JacqueGoupil Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
2:51 PM
@AwalGarg There's actually a case in C++. If ++ is an overloaded operator (you define a function for ++), that function doesn't know that the return value isn't going to be used
 
@corvid They will overwrite your callback arguments though, not sure how you'd get around that
 
How would you call the slide_logos at the end of this page ? http://www.agencedevoyage.com/
A "looping marquee with no gap" ?
 
user1596138
!!> window.crypto.getRandomValues(new Int32Array(1))
 
@Jhoopins "ReferenceError: window is not defined"
 
user1596138
You bitch
 
2:52 PM
@BenFortune Yeah, that seems a bit weird... maybe it's an X-Y problem, because I just want to unbind the event listener when I am done
 
@Jhoopins Web workers have crypto
 
user1596138
Global? Or where
 
Yes
 
user1596138
!!> crypto
 
@Jhoopins "ReferenceError: crypto is not defined"
 
2:52 PM
Huh
 
user1596138
Hmm, does Firefox?
 
Zirak didn't add it to the whitelist
 
@CapricaSix Sorry about that and thanks for the shortcut, the more you know.
 
@copy ah, makes sense. So in case there is no overloading, the claim of book is incorrect, right?
 
@AwalGarg No, the book mentions that
@AwalGarg Although, it can still be optimized away though, by inlining the function
 
2:54 PM
So yeah, this is more a joke than anything but does anyone see the use for this...
function _(value) {
  var Box = function() {return value};
  Box.valueOf = Box;
  Box.toString = Box;
  return Box;
}
 
@JacqueGoupil wtf
 
!!> window.gamepad
 
@corvid "ReferenceError: window is not defined"
 
@JacqueGoupil I suppose it makes any value constant? Just my guess
 
@copy well, not in the screenshot so I guess it must be elsewhere.
 
2:57 PM
@Neil There's more to it. It makes a value unserializable too.
http://jsfiddle.net/thePivottt/3hq4bsoh/
JSON.stringify doesn't work on functions :)
 
@Callum apparently .find and .findAll were already in a DOM proposal, but were never shipped. They function very similar to querySelector, but they're more useful/powerful due to their relative selectors
 

« first day (1776 days earlier)      last day (3187 days later) »