« first day (1038 days earlier)      last day (3913 days later) » 

4:01 PM
myArray.sort(function( a, b ) {
    return +a.match( /\d+/ ) - +b.match( /\d+/ );
}).join();
 
@Zirak
Thats nice, though i don't think he will come here to discuss
@Zirak @Shmiddty
Thanks for the support =)
 
So does this: Just change the array, hurr durr. myArray = ["lu9","ma9","mi9","lu10","ma10","mi10","lu11","ma11","mi11"]; The question doesn't explicitly state that the array will ever contain different items, so this is the best answer, obviously. — Shmiddty 53 secs ago
 
@jAndy doesn't consider the string part. Oh i didn't knew that the +null gives 0 as well,
 
thats one of those questions where you can have a quick'n'dirty solution which works for like 98% of all cases
or you can extend it endlessly :P
 
@C5H8NNaO4 No problem at all
!!should I give up
 
4:05 PM
@Zirak Yes!
 
<3
@RoyiNamir Your solution isn't very good. It works to the letter of the question (I have input A and want output B), but not to the underlying problem (I have input of form A and want output of form B). But higher forces commanded me to give up.
 
0
Q: Stream uploaded file to Azure blob storage with Node

Charlie BrownUsing Express with Node, I can upload a file successfully and pass it to Azure storage in the following block of code. app.get('/upload', function (req, res) { res.send( '<form action="/upload" method="post" enctype="multipart/form-data">' + '<input type="file" name="snapshot" />' + ...

 
My damn wlan just broke again >.>

@Zirak =)

@Shmiddty :D indeed
 
is there a way to hand a file to a <input type="file" > with js?
 
Hey peepz
 
4:14 PM
@Zirak You might find this slightly amusing. youtube.com/watch?v=0vvU-Ajwbok
Kind of gave me a headache because then I had twice as many voices in my head.
 
Cool. I'll have to watch it later though (alone at the office => no headphones)
 
Oh, I finished book two!
I didn't hate the ending as much as I hated book one's.
Here, things are actually looking up, sort of.
 
I tried pushing the file to the inputs value but: Uncaught Error: InvalidStateError: DOM Exception 11
 
@SomeGuy Dude that's freaky.
 
@SomeGuy ...how is that looking up!?
 
4:17 PM
@Incognito Shtewwpid.
@Zirak Well, no one's clearly dying yet!
 
@SomeGuy I have to have claudia chifford affect my design
=/
 
@bushdiver you can't, security matters.
 
@Farhan Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
0
Q: What service could be adding NewRelic?

Chris NicholsonAt the bottom of my web pages is: <script type="text/javascript"> if (!NREUMQ.f) {NREUMQ.f=function() {NREUMQ.push(["load",new Date().getTime()]);var e=document.createElement("script"); e.type="text/javascript"; e.src=(("http:"===document.location.protocol)?"http:":"https:") + "//" + "js-agent.n...

 
user image
4
@BadgerGirl ^
And the front, for @OctavianDamiean:
 
4:34 PM
These guys are crazy. Why did I never talk to that @BadgerGirl ?
 
> Why dis I lever tank go that @BadgerGirl ?
wat
 
wat
 
What??
 
oh.
@dievardump are you drunk?
 
Phone in French...
 
4:35 PM
hahaha
 
Nexus 4 auto correction and keyboard CAN be a pain
And I am in Berlin, so I am obviously under alcohol influence
 
Hahaha
 
Shit I did edited the sentence.
 
anyway, I once talked to Eva. But I didn't know it was her and hung up because I thought it was some spam.
 
4:38 PM
It was: these guys are crazy. Why did I never talk to that BadgerGirl?
No but even here. I never talked to her.
 
@BadgerGirl Please start harassing @dievardump when he's around!
 
"Tank go that girl" sounds pretty seksy.
@FlorianMargaine I also decided to move in Berlin instead of London.
 
This city is pretty cool. Beer everywhere every time. Employment for developers is good. Rent is freaking cheap. Life is pretty cheap
 
4:45 PM
whats the city
 
Berlin i think
 
As jAndy says it looks like the BayArea but... Cheap
 
Sounds enticing.
 
Yes @jAndy after one week here am like... Decided.
 
@dievardump you are already here ?
 
4:47 PM
People are welcoming. Party is from 3am to 10am. It's just a dream for me.
 
I only visited Berlin twice, i found it being too big after living my life in Freiburg
 
yeah I visited a friend for the past week
Going back to France tomorrow
But will come back here at the end of September I think
I already downloaded all the apps about learning German I could find
I used to learn German for 7 years so it'll come back pretty quickly
 
sounds pretty exciting, I think you will like it alltogether
 
@RandomJoe Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
I'll go on vacation after Bordeaux for two weeks, do you guys know a nice camping site for surfing?
 
4:52 PM
Everywhere next yo Bordeaux I guess.
 
arcachon
 
I do not surf but I heard this area is a pretty good spot
Biarritz und Bordeaux
Osgore too
 
@Tushar Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@DeSmOnd Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Arcachon seems pretty nice, i'll definetly discuss this with my girlfriend, thanks @FlorianMargaine

@dievardump Yes me neither, but i wanted to give it a try for quite a long time and heard only good things about Bordeux, but didn't had a clue on which campingsite to stay =)
 
@C5H8NNaO4 Arcachon is the most famous place around. It's also quite touristic, so probably more expensive
 
4:58 PM
need help for directory browsing script in ,tomcat server side.
 
Im really stuck with one thing relating to typed arrays ...
 
`(for (you (,unquoted)))
 
and the performance advatange that they have over simple arrays
 
anyone have any knowledge of using .apply with IE8?
 
@jbolanos it's not supposed to be any different than with other browsers
@Tushar they can be optimized in C arrays
 
5:00 PM
well you cannot use it on host objects
 
@Esailija well.. yeah
but you can't use host objects in IE8 anyway
 
@FlorianMargaine I'm getting the error Function.prototype.apply: argument is null or undefined
 
@Florian It seems to be at around 42..60€ for 9 nights, that seems pretty cheap compared to Germany. The other camping sites are similar. I guess the whole area there seems to be quite nice. Yeah I'm going to enjoy this =)
 
as in var call = function(){}.call; call.call(document.getElementById, receiver)
 
@Esailija finally I found you .. :)
 
5:01 PM
@jbolanos show the code
 
function getThresholdValue(data) {
    var rollup = data.rollupData;
    var th = [];
    for (var i in rollup) {
        var x = Math.max.apply(Math, rollup[i].kpiData);
        th.push(x);
    }
    if (th.length >= 2) {
        var x = Math.max.apply(Math, th);
        return x;
    } else {
        return th[0];
    };
}
 
I should get me something to eat, goodbye SO
 
it finds the highest value in the array so I can test if it's higher than a set threshold
 
@jbolanos rollup[i].kpiData is undefined prolly
 
@jbolanos add the hasOwnProperty check
 
5:02 PM
@Tushar hi
 
@C5H8NNaO4 cool :P
 
Hi @Esailija
Would you mind explaining me where I am wrong?
 
you are allocating 10mb per each iteration
 
I guess my understanding is not right
 
your computer will immediately run out of memory and use CPU to free memory as much as possible and screwing up the results
 
5:03 PM
@Esailija in call.call(..., the first argument should be the function, the second argument should be its context, and the rest should be the arguments. You are calling document.getElementById without arguments and with some suspicious context.
 
@JanDvorak I am calling it correctly
 
What?
 
@JanDvorak try it
 
call.call(document.getElementById, receiver) is equivalent to receiver.getElementById()
 
yes
 
5:04 PM
you're not passing any ID
 
but in IE8 that is not possible because you cannot call call with host methods
oh yeah the getElementByID is irrelevant, it was an example of host method
 
ah, ok
yeah, IE8 is weird
 
@Tushar the website will run your code as much as possible.. your code allocates almost 10 megabytes of memory each time, can you understand that
 
how to browse thoriugh directory and files , like in jsp browser ?
but by using small javascript code .
 
<input type="file">
 
5:07 PM
that is for uploading files. i want to browse through files as well as folders
 
no can do
 
I think I'm going to push that my app doesn't support IE8 :)
 
good luck
 
seriously, who still uses IE8? LOL
 
:P
 
5:08 PM
@PatrickCollins Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
hi all
 
@jbolanos I use emulated IE8 to test IE8 compatibility
 
can anyone here recommend a memory profiler for IE?
 
@PatrickCollins hi patrick
@PatrickCollins Chrome's ow... ah
 
@JanDvorak hello
 
5:09 PM
@PatrickCollins hi again
 
i'm having a problem with a browser extension causing a memory leak
 
@JanDvorak I only use IE9 to test IE8 - otherwise I only use Chrome and FireFox (in that order)
 
the compatibility mode of ie9 was surprisingly good but the one in IE10 is just bullshit
 
@jbolanos I only use FF to test FF compatibility
 
@Esailija my system has 8GB ram. Secondly now if I try with Int8Array and thirdly I am running 1000*1000 iterations. Each iteration only 1 byte is allocated and overall 1MB is allocated to the array. But I see the same performance difference.
 
5:10 PM
everywhere i google i find siEve, but it a) is crashing on windows 7 and b) doesn't seem to support testing extensions
 
Also note that - I am using nodejs for all my tests
 
@Tushar can you show your node.js code then
 
@JanDvorak I use FireFox for Firebug - otherwise its Chrome - push comes to shove and I'll use Safari on my Mac (which I've grown to dislike)
 
operator = (count, items) ->
i=0
start = (new Date).getTime()

while(i++ != count)
items[0] = 1000

return (new Date).getTime() - start




size = 100*100*100*10
arrSize = size #use a value very small and see the difference

simpleArray = new Array arrSize
uArray = new Uint32Array arrSize
intArray = new Int32Array arrSize

console.log('Simple:',operator(size, simpleArray))
console.log('UArr:',operator(size, uArray))
console.log('Int:',operator(size, intArray))
 
5:11 PM
now you are doing the mistake of running the benchmark only once
 
@Loktar Working on stuff that doesn't Compile is a POS - when do I get to goof off?
 
the website runs your test hundreds of times
 
!!/xkcd 303
 
also you don't use separate functions for the tests, you need to premake different functions so that the optimizer can warm up
 
5:12 PM
I call them separately
 
why am I even arguing this.
 
@Esailija because I am listening?
 
I already showed you injsperf that I can make them look like they run in the same speed.. because they do
 
I need a JavaScript compiler - Mwahaha
 
And my js perf ?
 
5:13 PM
your js perf is broken, you are allocating in a loop
 
that showed that typed arrays were much faster
din't tey?
 
tl;dr - jsperf is bad. don't rely on the results.
 
I ran the same code with node js
10-15 times
 
@Tushar you can't just use jsperf. You need hypothesis and understanding, then you use jsperf to verify the theory.
if the theory is not matched, then you try to think what is wrong with the jsperf and fix it
the theory is that they should be the same because V8 optimizes integer arrays
 
@Esailija ohh that crafty V8
 
5:15 PM
with node js - iteration over 1000k elements on a simple array takes 79ms
 
always doing something when we expect it to be doing nothing
 
where as on a typed-array it takes 4ms
 
@Tushar run the function 1000000 times. Then profile.
 
@Tushar you are only running the function once, thus the optimizer will not even look at it
and use different functions
 
i made a pendulum mini game thing
 
5:18 PM
Let me try that ... but can you tell why having different functions will help?
 
because the optimizer will optimize them according to the type you pass
 
Can you update the gist please? I feel that I am still not getting your point
 
do you know Java?
 
> GREAT! 6 degrees from perfect
@eazimmerman way to hard
 
in Java, you would have to make separate methods like operation(IntArray arr) and operation(Array arr)
 
5:20 PM
but reminds me of the old school arcade game
 
> GREAT! 1 degrees from perfect
 
make it bigger and with lots of colours
 
if you want performance, you will do that in Javascript too
 
1 degrees. lol
 
also handle 1 degree
 
5:21 PM
The trick is to hold the button down, then release when you're trying to hit the mark
 
@rlemon fixed
I will make it so you don't need to be on the 0 degree mark. Maybe just within 9degrees or so.
It's a mini-game I've been meaning to make for a game I have in mind.
 
> animation-duration: 10s;
now it is too easy
there is no happy medium
 
function benchmarkSemicolon() {
        ;
}

function benhmarkSemicolon2() {
     ;;
}
 
...
Please tell me there's no difference.
 
function benchmarkSemicolon() {
        ;
}

function benhmarkSemicolon2() {
     benchmarkSemicolon();
     benchmarkSemicolon();
}
 
5:25 PM
@rlemon enough heat up should inline both to oblivion
 
!!re-arrange office or finish content pages
 
@rlemon finish content pages
 
okay dokay
 
@rlemon nice, much more DRY
 
Who wants to delvote a recent question? stackoverflow.com/questions/18316875/…
 
5:26 PM
@Esailija No i don't know java.
 
@RyanKinal no I am just joking
@Tushar do you know any real language
(hahahaha)
 
C#
 
well that actually doesn't make any difference from the point I tried to made
the syntax was the same in Java as C#
 
operatorInt = (count, items) ->
i=0
start = (new Date).getTime()

while(i++ != count)
items[0] = 1000

return (new Date).getTime() - start

operatorSimple = (count, items) ->
i=0
start = (new Date).getTime()

while(i++ != count)
items[0] = 1000

return (new Date).getTime() - start




size = 1000*1000
arrSize = size
simpleArray = new Array arrSize

intArray = new Int8Array arrSize
console.log('Simple:',operatorSimple(size, simpleArray))

console.log('Int:',operatorInt(size, intArray))
@Esailija just ran this
 
$foo.toggleClass('foo');
return false;

whenever I write jQuery I feel I have to be as clever as possible.
return !$foo.toggleClass('foo');
 
5:30 PM
Simple Array takes 72ms and Int8Array takes 2ms
 
then I realize that is stupid
:/ stupid jQuery pulling me into stupid ideas.
 
well you are still running it just once and not warming up
 
ok let me try running it multiple times
 
!!youtube borgor nympho
 
5:32 PM
should object creation be also done multiple tyms
?
 
Dirty but awesome song ^*2 @RyanKinal
 
@es
 
no
I will show
 
can anyone tell me why this is coming up false even when there's a key set for chart_123
if (/^(?:chart_)/.test(key)) {
    return true;
} else {
    return false;
}
 
> We include modernizer which adds a js class to the body tag, but if modernizer doesn't load we add it in our own plugin
 
5:35 PM
@jbolanos whitespace? Is key really a string?
 
@Tushar it takes so fucking long to run man
 
tl;dr - they include modernizer (from our server) but then fallback to another file from our server if it doesn't load
 
3-4 seconds ?
@Esailija
 
hmm I suppose I can warm them up with smaller size.. sec
ok finally
I got 9ms for both with 10 million items when warmed up
@Tushar here's the code hastebin.com/demijivaco.js
lol wait the sizes should be before the benchmark
 
Guys, I'm freaking out. How do I tell a boss that told me not to take anymore days off that I need wednesday off for a very important interview?
I'm obviously going but I don't know how to handle a potentially angry employer
 
user1596138
5:39 PM
@Tushar This seems..... Stupid :/.
 
@JanDvorak no - I'm an idiot - I was testing the first occurrence which just so happened to not meet the test so returned false and that's murder she wrote for that function
 
@Jhawins wat?
@Esailija I ran the updated js - gist.github.com/tusharmath/6271339
Simple: 74205ms
Typed: 1354ms
 
you need to initialize the array
intarray is auto-initialized
 
user1596138
@Tushar What are you trying to do.
 
@Jhawins prove to @Esailija that typed arrays perform better
 
user1596138
5:44 PM
@Tushar In coffeescript?
 
I already proved to you that they perform only 20% faster
 
user1596138
No one gives a single fuck.
 
@bcr Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Javascript / coffee script
wat diff does it make
 
user1596138
What are you using to test the speed of these? Link?
 
user1596138
5:45 PM
Don't say jsPerf.
 
he is using ad hoc
 
@OctavianDamiean I'll be battle-ready in ~30 minutes
 
user1596138
!!stat Tushar
 
@Jhawins Tushar has 447 reputation, earned 8 rep today, asked 60 questions, gave 17 answers. avg. rep/post: 5.8. Badges: 0g 1s 15b
 
user1596138
5:47 PM
@Shmiddty Trippy...
 
function checkForCharts() {
    if (localStorage.length !== 0) {
        var isChart = false;
        for (var key in localStorage) {
            if (/^(?:chart_)/.test(key)) {
                isChart = true;
            }
        }
        return isChart;
    } else {
        return false;
    }
}
That's better - right? :)
 
@Shmiddty nice man you just need to fill it
 
@Tushar run this, I doubt you will see huge difference like 2 vs 78 hastebin.com/bayokidabo.js
 
for (var key in localStorage) { seems like a bad idea
 
why is that?
 
5:48 PM
I love putting stuff into localStorage even if I'm not the page author. Say, I'm a userscript author.
 
limited audience - internal app
 
Not to mention I'd be afraid to not pick up any of its standard methods
 
only about 3,500 users
 
jsbin.com/ubapig/5/edit I think the timing is correct here
 
3.5k is enough to find one that is tech-savvy enough
 
5:49 PM
@Zirak I iz back from gym.
 
they'll only be screwing it up for themselves
 
I need about 30 minutes.
 
but not deliberately
why not just pack the keys into a single object that you serialize into LS?
you won't be hogging 100% of the name space this way
 
these are number crunchers looking at charts - if they fill the need to play with localStorage on a charting app....
 
isChart = true; could be return true
 
5:52 PM
lol how could i be so stupid
 
then an unconditional return false at the end
 
he was using fucking uint8 array all this time
sneaky devil
 
@JanDvorak yeah - I'll go with that - leave off that stupid else false
 
I get hastebin.com/qafogosore.js 12ms vs 9 @Tushar
 
yep... else{ return false } isn't nice ;-)
 
5:55 PM
@Esailija which is what?
 
!!clever solution or sensible solution
 
@rlemon sensible solution
 
the bot knows...
 
@Tushar 12 ms for simple arrays and 9ms for int32array
this now matches the jsperf time
 
Me too ...
with node js
 
5:56 PM
but of course uint8 will be much faster if you can use uint8
(For sequential access)
 
@SomeGuy That's not as nsfp as I thought.
 
anyone here have an arduino ?
codebender.cc keeps crashing on me (Chrome + Win7)
 
@Esailija I ran it 1000 times and got Simple: 4964ms
Typed: 1377ms
 
:11325384
function checkForCharts() {
  for (var key in localStorage) {
    if (/^(?:chart_)/.test(key)) {
      return true;
    }
  }
  return false;
}
 
can you show code
 
5:58 PM
What the hell? Something is wrong with my system. It's either Firefox that made my entire system (Windows 7) freeze or something else.
 
@OctavianDamiean dude! I am having crazy issues over here as well
 
Firefox too?
 
Chrome AND the Ardunio desktop software
:(
 
Winblows
 
Chrome.
Mhmm.
 
5:59 PM
@Michael return Object.keys(localStorage).some(function(){...})
 
jBLOWSanos
 
Some websites managed to just crash the browser and sometimes Firefox seemed to crash the system.
Strange strange.
 
I get the same with chrome
but then again, only when there is a plugin that deals with the filesystem
 

« first day (1038 days earlier)      last day (3913 days later) »