« first day (1679 days earlier)      last day (3268 days later) » 

7:00 AM
ok thx for the help buddy
 
Wow, thx Jan, that could actually help !
 
Also, the cpu profiler flame chart view of looks awesome
 
it's ok when you're trying to optimize a full process involving many functions
I'm trying to optimize a single function :)
that is called many many times ^^
 
more functions?
 
7:05 AM
I jsut have one fucntion that is causing performances issues
 
any chance we could take a peek at that function?
 
like 5 seconds in the profiling tools :D
 
if I have three domains (example1.com, example2.com, example3.com) and they're all on IP 101.88.101.99, what's the easiest way to redirect them?
nginx looks like a total headache
(they're each listening on different ports: 4000, 5000, 6000)
 
uot of context it wouldnt make sense I'm affraid :(
 
@Sisyphe I mean, if you split it into multiple functions, the cpu profiler will give you more information
 
7:07 AM
hmmm
 
in fact, it is a nice use-case for non-recursive immediately invoked named function expressions
 
smart idea
I'll do that ^^
it's not a buig function, it's like 50 lines
but it's recursive and asynchronous :'(
 
if it's asynchronous, then 5 seconds might be reasonable
5 seconds on CPU churning is pretty bad
 
5sec self time
 
:_:
 
7:09 AM
in my context it should not take more than 100ms...
yeah tere is something going terribly bad :D
 
five seconds per call?
 
I just checked again based on dystroy comments
its not optimized, i have a warning :"optimized too many times"
 
Now I want to take a look, with or without a context
 
no 5 sec total
its called thousands of times
gimme a sec
 
oh. Not as bad then
 
The solution probably is to forfeit dynamic typing and have monomorphic everything.
 
here u go
 
*you
 
waht you just said sound very interresting but I did not understand it at all :)
 
monomorphic = every variable has a single type
 
7:12 AM
ReferenceError: document is not defined, what does that mean..?
 
ok
Meraj99 that you are in a specific context like nodejs maybe ?
 
@Meraj99 In a browser that only happens in places where it is necessary
 
or another headless browser
 
um, im opening the page in chrome, from my ide...
 
7:15 AM
are you accessing a frame too soon?
 
@Sisyphe 50 lines is like big...
 
haha :)
 
@Sisyphe what the point of denoting which variables are objects and which are primitive values (I presume that's what v means)?
 
I'm working on code that is not mine and believe me, I'm pretty happy when I have 50 lines functions ^^
yeap, v Means variant
 
@JanDvorak nope, the <script> is like, the last line of the html
 
7:17 AM
this code is resolving a path
/object/subObject/property
 
@Meraj99 unlikely then. Fiddle?
 
each sub resolve can be a value or an object
 
I have a object something similar to this:
var obj = { data: { name: "hello" } }
 
@Sisyphe IOW would you mind stopping using hungarian notation like this?
 
@Sisyphe (still in skype meeting) where's the code ? The gist link seems dead
 
7:18 AM
I need to go two level inside of that object dynamically
I tried this obj["data.name"]
which is giving undefined
 
@dystroy works for me. Here it is rehosted: jsfiddle.net/2uqaqo80
 
I'm following the team coding rules mate
I don't decide
dystroy gimme a sec
 
@Mr_Green so far so expected. What's the question?
 
@JanDvorak uh, it works on fiddle... maybe ive installed something wrong?
 
I need to jump two level down
obj.data.name will work
 
7:20 AM
@Mr_Green split by period?
 
it could be more like x.y.z.sadfsad.sdf.safd.ds
not just two level
 
split by period
If it's a throwaway code I might even let regex + eval pass
@Meraj99 what browser?
 
Hey guys. One of our apps is failing in Samsung Galaxy Edge SCL24 . Any ajax calls are going directly to the fail() function.
any idea what the problem could be?
 
@JanDvorak Chrome Version 43.0.2357.65 m
 
its a phonegap build working for everyone but that one person with that device.
 
7:23 AM
@doodla browser settings?
 
@JanDvorak Its a phonegap application. downloaded via the play store.
 
If it's a local app, that guy might have just disabled internet access for that app
 
@JanDvorak so later I need to do for loop right?
 
she's actually trying to make it work
 
@Mr_Green define "later"
 
7:24 AM
sent us a support request
 
@JanDvorak after splitting with dot, I need to do for loop to the array right?
 
@JanDvorak nvm, got it, ide settings were messed up badly... ty anyway :D
 
:-(
@Mr_Green yes
 
ok thanks I was thinking there might be simple way.
 
@JanDvorak any idea?
its a Samsung Galaxy Edge SCL24
 
7:36 AM
the slice could be an issue...
 
How big is the array?
 
very small
worst case may be like 6 or 7 elements
its a path, so it depends on the hierarchy depths of objects
 
that shouldn't take too long to slice
 
but the slice create a new array (so memory allocation, garbage collection when its not reference anymore, etc...)
the slice itself, no
but the fact that we create and dispose thousands of arrays could be an issue no ?
 
could
 
7:40 AM
I'm not convinced either :D
I also suspected the creation of the jQuery deferred object to cause issue... but well, it seems unlikely too
 
Replace it with bluebird promises, then report back
 
can't do that :'(
I have restrictions
 
it could be an issue
 
are jQuery promises supposed to be bad performance wise ?
 
Nope. jQuery just sucks in terms of performance
 
7:46 AM
fully agree with that...
anyway, thanks a lot for having taken time to lend me a hand :)
I appreciate that
 
(as it turns out, nginx is not so bad—the docs are just terrible)
 
the docs are terrible?
I've found them to be very nice
 
Does any one uses github.com/nuzzio/grunt-strip-code for striping the code in production and make available only in test env?
 
@Ant's no, I use gcc
 
gcc for js?
@FlorianMargaine
 
@FlorianMargaine: Sorry, btw what sort of code it is
?
 
it's js
using gcc preprocessor
 
@FlorianMargaine okay, they aren't that bad, but they could be nicer
like MDN js nicer
 
@FlorianMargaine: So you too uses gcc pre-processor to remove the test env fn in production?
 
@Ant's no, I use gcc to add the test env fn in development
which is very different
 
7:57 AM
@FlorianMargaine: Thanks, what do you mean by add the test env fn? Can you elaborate more on it? You add the fns in run-time for testing purposes? Any examples ?
 
@Ant's what did you mean by "remove the test env fn in production"?
 
@FlorianMargaine: Imagine I need a setter fn, which helps me in setting a private variable. However this setter fn I dont want to be in prod code, but yes in testing environment.
 
there you go, you have an example
although a terrible one
this is a better example: gist.github.com/Ralt/…
 
is it better to inject lodash as a factory like $return $window._ or as a constant .constant('', window.) ?
 
@argentum47 I don't see the point in wrapping things like lodash into the DI concept of Angular
 
8:03 AM
@FlorianMargaine I thought it was -DFLAG?
 
Like, what's the benefit?
 
@royhowie both work
 
okay
 
@FlorianMargaine: cpp -P -nostdinc -D DEV test.js running this, gives me
clang: error: no such file or directory: 'c'
clang: error: no such file or directory: 'DEV'
clang: error: no input files
 
was trying to figure out whether my memory was faulty /seg-fault
 
8:04 AM
@Ant's cool
this is what I get:
[florian@localhost tmp]$ cat test.js
/*
 * $ cpp -P -nostdinc test.js bundle.js
 *
 * # OR
 *
 * $ cpp -P -nostdinc test.js
 *
 * # To give parameters, use -D, like this:
 *
 * $ cpp -P -nostdinc -D DEV test.js
 *
 * # For source code like this:
 * */

#if defined DEV
#define ASSERT(x) console.assert(x)
#else
#define ASSERT(x)
#endif

#define SOME_CONST 5

var Promise = require('bluebird');

ASSERT(1 === 1);

Promise.cast([1, 2, 3, SOME_CONST]).reduce(function(_, i) {
    console.log('Launching ' + i);
 
@FlorianMargaine: Something interesting is going on my machine!
let me check
 
not really interesting
you're using clang instead of gcc, is all
 
@OliverSalzburg ok
 
someone needs to make more thug life videos from CSPAN clips
 
@FlorianMargaine: Yeah this is mac machine. Probably I need to install gcc
 
8:10 AM
just kidding, that was a lie. You do
 
@royhowie: Why?
lol!
@FlorianMargaine: Removing the space:
cpp -P -nostdinc -DDEV test.js
does the trick
 
@Ant's that's probably something clang-specific
 
Morning
Hi @Dash
 
@royhowie: Probably I never know
@FlorianMargaine: Thanks for your help, never knew this trick ! And say what if I want to remove the preprocessor and get only the js file, what command I need to run?
 
@Ant's sorry?
 
8:21 AM
@FlorianMargaine: Sorry I was about to ask one question, got it resolved!
thanks
 
SGG
8:36 AM
@royhowie Thanks, it is there. but How to download it. This is the URL: home.nest.com/images/magma/thermozilla/icon/… It is saying forbidden. How to download the resource then?
 
@SGG drag it to your desktop or something?
 
@royhowie done
 
@AnkitPatial No, no, no, NO! That is the completely && absolutely wrong way to do it. If you insist on shuffling the array (queue) and just polling for a random element, you should at least use an unbiased shuffle, e.g., Fisher-Yates. Read up on why here. — royhowie 4 mins ago
I hate when people try to shuffle with Math.random
 
1 message moved to Trash can
 
@royhowie I'm interested in how you would shuffle without Math.random
 
8:50 AM
@JanDvorak clarification: Math.random alone
 
Not clarification enough; sorting with a random key is perfectly fine. Sorting with a random comparator isn't.
 
If you just return Math.random() - 1, your shuffle will be biased (towards where elements originally were)
 
@JanDvorak You know @royhowie was commenting on that (shitty) article, right ?
 
>Note that this solution does not perform a completely randon sort on the array and entries will still be biased towards their original positions in the array. This is because of the particular sort algorithm that JavaScript uses.
I like how they try to blame it on the sorting algorithms "JavaScript uses" instead of their algorithm…
 
This isn't even guaranteed to end. Throw a bubble sort at it and it won't stop for a while.
 
SGG
8:54 AM
@royhowie It's saving as .url format.
 
@SGG can you right-click the picture and choose "save as"?
 
SGG
@royhowie there is no such option
 
which browser are you using?
(is there a "download image"?)
 
SGG
@royhowie I'm using chrome. "Copy image URL, Copy image as dat URL" are there.
 
"open image in new tab" ?
you could also "copy image as data URL" and then paste that url into an <img> tag on a test.html page
 
SGG
9:00 AM
@royhowie In new tab it's saying Forbidden 403. I'll test "copy image as data URL". Thanks
 
@SGG (you need to set it as the src of the tag)
@RoelvanUden how much faster is gaikan compared to jade?
nvm I just read the section
 
@royhowie IIRC about 50x or so. Run the benchmarks to be sure.
 
@royhowie I don't recommend Gaikan as production template engine though; it's not mature enough for serious things.
 
@OliverSalzburg sounds likely to cause bugs, since they have different precedence
 
SGG
9:04 AM
@royhowie Thank you so much. image as data URL working.
 
@AnkitPatial even worse, it isn't even guaranteed to finish. If the browser uses a really poor bubble sort implementation, it will take exactly 1024x more (expected) time to shuffle a ten-element array than it takes to sort it using a proper comparator - and the slow down grows exponentially. Using the same sort it will take literally years to shuffle a 50-element array. About four years if each swap takes a nanosecond, to be exact. And yes, shuffling an array just to select an element is backwards. — Jan Dvorak 1 min ago
 
@royhowie Someone on SU chat yesterday posted code like $a && $b or $c
 
I would say "ew", but that applies to lot of PHP...
 
9:34 AM
hi all
@AwalGarg Are you there?
 
Merge ALL the clones!
 
10:08 AM
I'm voting to close this question as off-topic because it is not about programming — dystroy 8 secs ago
Off-topic self answered question on emoticons...
 
The best part of these emojis is that they work in W7 Chrome
 
ASR
how much time it will take to develop this site ? woodstockschool.in
 
Two answers...
@ASR It's already developed.
 
ASR
what is the other answer?
 
@ASR What?
 
10:16 AM
@ASR deleted by owner
 
@ASR about 6 months
give or take another 6 months depending on bureaucracy
 
the question is who will own the merged repo,because jdd and jashkensas do not always see eye to eye,i think jdd was banned multiple times from underscore and so on...and jdd always seems to be critical of underscore and its performance in his talks on Unorthodox Performance
 
user1994804
@BenjaminGruenbaum I apologize, I prolly went over and beyond what was necessary but the whole ordeal just kept spiraling out of control for just the reasons I stated and got blocked again and again for
 
user1994804
It became a vicious cycle
 
user1994804
I'd bet you know who I am and youre claiming you don't to try to extinguish the flames. Thats cool but you were the guy who entered the room and immediately deleted my code
 
10:27 AM
lol
 
user1994804
I FORGOT about Ctrl+K at that moment as Im novice and already was maxed on internal ram (my brain was spinning at that moment)
 
okay tomorrow i am going to fail
 
The rules of this room say "use pastebin"
 
Maybe if you followed the rules, your code wouldn't get deleted.
:P
 
the room name sayd "use pastebin"
 
user1994804
10:28 AM
and when you introduced yourself by kicking me in the nuts, it couldn't have turned out well
 
90% users use pastebin. 10% users retry with no success. You flipped out.
 
user1994804
@BenFortune it was like 4 lines
 
What do you mean by kicking?
 
user1994804
Does "kicking me in the groin" make it easier
 
Surely not literally, so in what sense?
If we kicked you from the room, it wasn't due to four lines of unformatted code.
 
user1994804
10:30 AM
Yes I flipped out. What do you expect when someone spits on my shoe?
 
Discuss it in a civil manner, instead of acting like a child?
 
I expect them to pull out a rug and start shining my shoe, actually
 
They probably expected you to behave like an adult
 
user1994804
If u can't figure out the analogy of "Kicked me in the groin" I can't explain it any more
 
user1994804
@JanDvorak EXACTLY
 
10:31 AM
Too bad. We hoped we could explain to you what you did wrong.
 
user1994804
Yep, ya'll have got that on me. It was immature and I apologize
 
user1994804
I only responded
 
user1994804
There's a saying that applies to me
 
user1994804
just a sec
 
user1994804
I can't find the "Picture" but it can be more less summed up as
 
10:33 AM
hey,could you guys help me understand why one would want to treat null and undefined differently in if conditions?
 
user1994804
treat me with respect and i do the same in return, shit on me and I'll stomp your ass in the ground
 
user1994804
but I greatly prefer
treat me with respect and i do the same in return
 
@YourAdrenalineFix beautiful words
 
@Julo0sS now I am
 
user1994804
Look and see
 
10:34 AM
@twiz It has docs? :O
 
user1994804
www.google.com/+StuartKaufman
 
user1994804
THAT is who I am
 
@vamsiampolu Because null and undefined are different?
 
user1994804
Not what most of you saw out of me between me and BG
 
user1994804
Best to Everyone
 
10:38 AM
@BenFortune i understand that undefined is a type of a value which is defined but has not been assigned a value,null is a value provided to say that something has no value,what I dont understand is when I am checking in a condition,why would this difference matter,given that void 0 is used to set something to undefined?
 
@YourAdrenalineFix Holy shit you look like Woody Harrelson
 
user1994804
and over & out
 
I am curious what he said...
 
user1994804
@BenFortune I've heard Tony Howk before
 
user1994804
I'll take it as a compliment and Thanks
 
10:39 AM
should one use void 0 and set something to undefined?
 
user1994804
BTW, My profile pic and pics on G+ are all very recent and is how I look RIGHT NOW typing this
 
user1994804
Over & Out with Peace and Love my Brothers
 
Also don't use void
Because undefined means a variable hasn't been assigned a value, whereas null represents an empty value
90% of use cases, it's wrong
 
0
Q: Determine the move in which a LOGO turtle crosses a point that it has already visited

CMCDragonkaiSituation: A turtle starts at (0, 0) on a cartesian graph. We have a non-empty zero-indexed "moves" list that contains numbers. Each number represents the distance moved. The first number is the distance north, the second is the distance east, the third is the distance south, the fourth is th...

 
The message timeout in chat is too low... There should be a status indicator like in facebook
 
10:42 AM
clap
 
Forever writing sentences then follow-up sentences, when the first sentence fails
Making them the wrong order and making no sense
 
ok,so I should differentiate them to check if a variable hasBeenReset = value=> _.isNull(value) and hasNeverHadAValue = value => _.isUndefined(value)
 
@YourAdrenalineFix dude, I'm sorry if I did someone to offend you but I honestly don't remember who you are, I have no beef with you if you don't have any with me. So no hard feelings or anything - did you have another alias or anything?
 
@BenjaminGruenbaum just saw his history, I think he is talking about this: chat.stackoverflow.com/transcript/17?m=22699795#22699795
you moved his ugly unformatted code to js trash (and probably kicked him) (for the good)
and he took it way too seriously.
 
Blame @rlemon
Apr 15 at 13:11, by rlemon
kicked
 
10:50 AM
1 message moved to JS trash...can we do like, 1 person moved to JS trash??
 
@BenjaminGruenbaum please use this room the next time: chat.stackoverflow.com/rooms/61562/…
@web2students.com You can kick them
ok... that wasn't four lines... @YourAdrenalineFix
 
How do I English?
> Makes the previous message make no sense
 
The author using array of arguments to pass in new Date()
So, I thought to use apply
but it isn't working
 
@AwalGarg yep
so, as you asked
here is the output :
{"href":"https://192.168.100.22/websocks/","origin":"https://192.168.100.22","protocol":"https:","username":"","password":"","host":"192.168.100.22","hostname":"192.168.100.22","port":"","pathname":"/websocks/","search":"","hash":""}
 
10:54 AM
@Mr_Green perhaps because of the -1 part
 
some guy answered my post, and pointed something that could be interesting :
 
Can you use new with apply?
 
3
Q: Https Nginx NodeJS SocketIO And CORS request failed

Julo0sSHere is my problem, Context : I have a NGinx server working. NGinx uses a certificate to enable HTTPS. No problem from there. I have a NodeJS server working, which is just supposed to handle websockets, using socketIO. I am testing on Mozilla Firefox (which is maybe not the best thing...) ...

 
@BenFortune no
 
@JanDvorak I will consider the -1 later but I am actually wondering why apply isn't working here
 
10:55 AM
@Julo0sS no, that is not the problem
 
how did you use it?
 
var d = new (Function.prototype.bind.apply(Date, t));
 
@Julo0sS what happens when you do this in Chrome?
 
var t = "2010-06-09 13:12:01".split(/[- :]/);
t[1] = t[1] - 1;
console.log(new Date.apply(this, t));
 
@AwalGarg I try now
 
10:56 AM
@BenFortune not directly, there's a construct for that though
 
@Mr_Green new doesn't work with apply
 
1 min ago, by Ben Fortune
var d = new (Function.prototype.bind.apply(Date, t));
 
any way around?
 
1
Q: JavaScript - How to set new instance as parameter, created dynamically?

Ezio_I have a method which sets a new instance to an array, created dynamically. How can I do that without the use of eval()? var Form = (function(){ function Form(params){ this.shapesArray = []; this.shape; ... } Form.prototype.submit = function(){ ... th...

 
does Date.apply work?
 
10:58 AM
!!> var t = "2010-06-09 13:12:01".split(/[- :]/);t[1] = t[1] - 1;console.log(new (Function.prototype.bind.apply(Date, t)));
 
@BenFortune "undefined" Logged: "1905-10-13T16:01:00.000Z"
 
@AwalGarg it also fails
 

« first day (1679 days earlier)      last day (3268 days later) »