« first day (1774 days earlier)      last day (3399 days later) » 

user406009
00:03
The best version:
omg i can't
I'm resurrecting the star leader board in node
but it is going to take 14 minutes to scrape just the JS rooms stars
user406009
Scrape from where?
00:21
http://chat.stackoverflow.com/rooms/info/$(roomid}/?tab=stars
fuck off.
hit an error on page 200
doesn't write to the fs until it hits the last page
-_-
streams!
Observables!
Gustav!
Lazy!
page 70 again \o/
user406009
But that's sorta useless.
user406009
It doesn't tell you who starred what.
user406009
Just the star counts.
user406009
00:26
rlemon, you can have my data if you want.
user406009
I missed some today though, my server went down due to a bug.
user406009
(Stackoverflow 404ed on me and I wasn't ready)
We don't have access to who starred what.
user406009
Yes we do.
user406009
How else would my extension work?
00:26
they used to leak that info but fixed it.
user406009
Nope, still leaking.
huh, interesting. How do you propose we do that retroactively?
user406009
We can't.
user406009
But luckily, the star board cycles pretty quickly, so it doesn't matter that we only have new data.
00:28
here is a dump of mine
@Lalaland the leaderboard is less about who starred what, and more about who has the most stars
stars per message
etc.
user406009
Nice. I'll be able to recover my lost data with that.
user406009
Thank you.
page 335!
@Lalaland np
@SomeKittens If you see empty messages, change your code to ignore them. I switched to DEALER-REP. You shouldn't have to change any code on your side besides that
@Lalaland ignore star_id
that is my mapping relation
the rest should be relevant to you
00:30
@copy I've already got a .filter(Boolean) in there.
let's see if that works
user406009
Yeah. I've already fixed my server to be much more fault tolerant.
user406009
Now it just prints an error message and continues instead of dieing.
FUCK
I'm not recording userid
I'm almost done scraping too
:(
!!rescrape or write a script to get userid by messageid
@SomeKittens Looks good, I'll push the changes
@rlemon write a script to get userid by messageid
00:32
@copy I've got two scripts - all one is doing is writing whatever you send me to a logfile. The other is reading the file. That way the second one can die/restart/whatever and I'll keep going.
Good strategy
Problematically, this is all running on my PC, I'll need to shut that down sometime.
That shouldn't cause any problems on my side
!!flat file or postgres
@rlemon flat file
00:36
ahh, you want to make it interesting
;)
user406009
SQLite > flat file in pretty much every case.
user406009
SQLite is awsome and simple.
postgres > sqlite
:D
user406009
Yep. Postgres > sqlite > flat file.
but the bot spoketh
I must use flat file
which means I store as JSON and load it all into memory
:D
#fuckthepolice
user406009
00:38
That's actually not too bad.
user406009
You can even run "queries" with jq.
it's only 22670 entries :D
shouldn't be too bad
5 and a half minutes for the first 250 pages
not too bad
user406009
For interests sake, why do you need the number of stars?
so I can get stats like, total stars in the room per user
stars:message ratio
user406009
Ah. Actual analysis.
00:41
average number of stars per starred post
etc.
@copy Not sure if I'll reconnect properly. Guess we'll find out.
@Lalaland yea just for fun
ooh, you can come up with the perfect message
Well, really in need of help. If someone is up for a challenge... check my question out stackoverflow.com/questions/32193842/…
@jSmith 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.
user406009
00:51
@jSmith So your issue is that you need to split the letters in groups of up to 10?
Is there a testing framework for Node that's a library like a module, which you can "require" from your code and do the usual "describe-it" tests. Unlike Mocha in which you have to call "mocha …" from command line. Something that you can just require in your code and do tests from there?
user406009
Simply iterate over sortedProductsArray and split when needed.
yea
user406009
I would also improve your code by only calling groupBy once.
@laggingreflex Like you can just call "node test-file" instead of "mocha testfile"
00:53
i am calling it in different scenarios, i am not sure how i would make use of it only once
user406009
No, you are using it in only one scenario.
user406009
You need to divide your stuff into multiple groups: digits with certain leading numbers, letters.
user406009
function keyFunc(item) {
  if (!isNan(item)) {
    return  Math.floor(item / 10);
  } else {
    return Number.MAX_VALUE; //arbitrary
}
user406009
I just wish JavaScript had operator < define for arrays.
user406009
It would make my life so much simpler.
user406009
00:58
Then we could do this even more easily:
user406009
function keyFunc(item) {
  if (!isNan(item)) {
    return  [0, Math.floor(item / 10)];
  } else {
    return [1];
}
user406009
But alas, certain things were not meant to be.
help a drunk rlemon
I have an array of objects
[{userid: x, count: y},...]
I want to average them and report the top ten counts
user406009
You can use jq for queries.
link?
I assume you don't mean jQuery dom lib
user406009
okay, but I'm drunk
so I'm vamping
write it for me :D
First make a mapping from userid to stars { user1: [1,2,3], user2: [4,5,6], … }, then calculate the average for each user { user1: 3, user2: 5, … } then to array [{ user: user1, avg: 3 }, …] then sort by average then take the first 10
The last step can be done faster, but it probably doesn't matter
really tired must get on that tomorrow, thank you
user406009
IIRC it should be jq 'limit(10; sort_by(.count))' file
01:08
again, sorry, I might be being thick, but that returns a star with 3 count for > and <
user406009
jq's query format is a little strange.
also, here is my drunken scraper gist.github.com/rlemon/9222f2a1bf8a55c98efc
01:26
If you want to cringe; give this a look: github.com/ndugger/jdom
user406009
Array.of is Array.from
user406009
Your code is redundant.
It's not redundant, I must've forgot that it was from vs of
My bad
I'll change it
Wait, no, it is Array.of
what are you even on about?
wait, both exist
that's odd
user406009
Array.of(1,2,3) => [1,2,3]
Both seem to serve almost identical purposes
user406009
01:31
Array.from([1,2,3]) => [1,2,3]
user406009
Different uses.
With their polyfill, which I'm suming does what the spec says, they do work the same way
I tried using their polyfill to convert a NodeList into an Array, and it works just fine
user406009
Array.of(nodeList) gives an array?
!!youtube Seal - Kiss From A Rose
so, either their polyfill isn't up to spec, or they can be used interchangably
that's right.
What should I be using in my case, though I think Array.from might be more correct.
[...iterable]
it automagically destructures it?
should?
01:40
I don't think it should
I mean, I don't think Array.of should destructure if we also have Array.from
seems to create redundancy
Unless we;re okay with Array.of doing both jobs, then
in which case we don't need Array.from
[...n] is shorter
Yes it is
user406009
Shorter doesn't always mean clearer.
user406009
We aren't in a code golf contest.
It's pretty clear if you understand destructuring
01:47
Since class declarations are not hoisted, is this something I need to worry about if I use a concatenating build system for several JS files?
Why use concatenation vs webpack/browserify?
user406009
Simplicity.
Simplicity while writing the build system, but now he has to worry about hoisting, etc, so no, it's not simpler.
@Nick A simple "yes" would have sufficed.
What is this, a college campus?
01:49
babel concatenates files, and I'm using it, so I asked
@Nick No, it's a hippocampus
user406009
@Nick I CAN'T HEAR YOU FROM MY IVORY TOWER.
Babel doesn't do concatenation in the same way that you would do concatenation. They wrap things in IIFE-like closures
user406009
YOU NEED TO SHOUT LOUDER.
So you don't have to be concerned with hoisting, etc outside of your one file
Oh wait, you're talking about babel
I misread as browserify
I dumb
I would suggest you use something like browserify if you're gonna package all of your js up as one file
No need to manage hoisting, then
If I wanted to require everything, I'd use node
because I am using node
user406009
01:52
In all seriousness, I agree with Nick. There are even simpler options such as require.js
user406009
Babeljs can compile to pretty much any module system format.
If you're using node, you don't need to concatenate your files, then
I know, but babel does by default
Just have babel transpile them each into a dist/ folder, and point your modules there
I've never had babel concatenate files before
No idea how you're getting it to do it by default
01:53
I only have one file right now so it's not like it matters
@Nick babel src -o server.js
directory
Ah, sure, I always use it with something like gulp. gulp-babel doesn;t concatenate them
I'm not a clever software developer
Great at writing code, not so great at writing software
welcome to the club; we meet in rlemon's basement
I know
I've been watching
Should I declare properties in my class constructor if I don't need to initialize them?
user406009
What do you mean "declare properties"?
02:01
Yes, avoid later deoptimisation
And it's clearer
user406009
this.foo = null; ?
yes
babel is frighteningly slow
@Zirak Thanks! Yeah, I've noticed that. It tends to happen when you exit Phone to Chrome by using the home button instead of going back
hi peepz
anyone here familiar with employment agreements?
02:17
I know with a react component, you have to set a default state, which I do think is a bit odd
class Foo extends React.Component {
    state = { data: [] };
}
well, you don't have to, but you do have to set a default state that you can 'rely' on until you receive your real data
02:43
its not js, but hope someone could help me anyway, im trying to get a pairingsystem. players can only play against each other 1x, highest score against each other.

if i try my code with 4 players, player 4 will be playing all matches, instead of 2 pairings (for ie: player 1 and 2 have 3 points, 3 and 4 0, means it should be player 1 vs 2 and player 3 vs 4)
and i cannot see what i have don wrong, so a extra pair of eyes would be welcomed :)

http://pastebin.com/fAsUS17V
03:02
@SomeKittens in that case, I am doing a great job and deserve a raise
will tell my boss tomorrow
@ʞɔᴉN Nice job overachieving on the fourth stat. Way to go above and beyond.
Where do you work?
thanks man, I try
i work at a tiny little company down in Campbell; we do contract work for companies like Cisco for their marketing campaigns
so it's like demos/prototype apps, typically pretty simple stuff
The Martian vs Hitchhiker's
@SomeGuy who wins?
@ʞɔᴉN So sales engineering?
03:19
@SomeKittens Martian for sure!
Have you finished it?
82% of the way through, according to my Kindle
I'm so excited for you :P
The movie will probably convince a lot more people to read the book too
user406009
They ruined the Hitchiker's movie.
@SomeKittens Pretty much. We're trying to diversify into other roles (we have the talent, thanks to me of course!) but pretty much all of our current clients are marketing teams and that's always been our source of revenue
user406009
I expect them to do the same for The Martian.
03:22
Martian was a better read than I expected
avoided it for the longest time because I thought it would be boring and tedious but it was actually pretty intense
user406009
There are a lot of good books out there.
@ʞɔᴉN How many people work there/how many engineers?
user406009
The moon is a harsh mistress is another good scifi book which is sorta similar in tone.
@Lalaland oh hell yeah, all I read is sci-fi pretty much
@Lalaland You know who wrote the screenplay for the new HGTTG?
user406009
03:25
No.
@SomeKittens like.. 11 or 12? we have 4 devs right now which I think might be overkill
@Lalaland Douglas Adams
user406009
Doesn't matter.
user406009
It was still way worse than the novels.
anyone here read The Quantum Thief?
user406009
03:33
Not yet. But it does look sorta interesting.
user406009
I guess I should add it to The List.
what would be a good way to check in js if set of numbers in an array are divisble by two like so:
input = {2,3,4}
output={1,0,1}
@Lalaland put it at The Top
user406009
Use the modulus operator: %
and then you'll want to put other 2 in the trilogy right below
03:38
@feners mod
you may cry
im trying output = input.map(function(v) {return (v+1)%2;});
user406009
console.log(2 % 2)
user406009
@feners That works for me.
user406009
Minor style nit: booleans are better than 1s and 0s.
03:40
yeah but idk why with longer arrays it doesnt work..
user406009
.map(function(v){return v%2 == 0;});
user406009
Also, be careful with negative numbers.
jmm that might be my problem...
user406009
-1 %2 = -1 in JavaScript
ughh what would be a workaround this?
user406009
03:42
In general (a %r + r) %r deals with the negative issues.
yeah but I need it to return 1's and 0's
user406009
That's what the workaround I just provided does.
user406009
It's a way of forcing the output of % to be positive.
user406009
(And still correct)
ahh
i see
user406009
03:44
So (v+1) %2 would be turned into ((v+1) % 2 + 2) % 2. Per my formula
user406009
Or function mod(a, r) {return (a%r + r) %r; }
user406009
[2,3,4,-1,-2].map(function(v){return mod(v+1, 2);});
user406009
The stupid thing is that different programming languages have different behavior for the sign of mod.
user406009
At least wikipedia has a giant list.
user406009
WTF. Looking at the C90 entry: "implementation defined".
user406009
03:49
Useless
Rust has both
OCaml too
04:13
having issues, where the data isnt being appended to the select2 field.
I assume it's because, with ajax being asynchronous, the rowdata is being overridden by the next iteration before the ajax call completes
@feners val%2 ? 1 : 0 or Math.abs(val%2)
hi all
@hardcode 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.
and you checked the contents of filesList before you push the new files? — devlin carnate 11 hours ago
0
Q: How to remove added files from while adding next time?

hardcodeWhile uploading multiple files using fileupload js, the files that are added in first time are not removing while adding files next time, how to remove that files. For example, first I am adding four files and then adding different four files instead of first four, while uploading, it uploads al...

 
1 hour later…
05:46
@Doorknob Should be fixed now. You might get Dices Overflow Errors in the future
When the code you add to get data into the code snippet, and to get a result from the code snippet, is longer than the code snippet itself, I think you should re-evaluate your priorities... — Cerbrus 12 secs ago
This guy always does that. 4-line code snippet, 8 lines to get data in and out of the snippet.
user3119231
06:29
morning
07:14
evc is asking for answer review over in SO Close Queue chat
in SO Close Vote Reviewers, 42 mins ago, by evc
Why my answers get downvoted for no reason? What's wrong with me? OR why would they do it? my answers don't deserve downvote, and i think must be accepted http://stackoverflow.com/a/32196249/2308005, http://stackoverflow.com/a/32196755/2308005 but maybe it's my problem, can you boys review them PLease??
any takers here?
user3119231
takers?
user3119231
I don't think this stuff interests someone around here :D
Can confirm
user3119231
07:29
jooo @ivarni
07:49
I need little help in xml?
<?xml version="1.23.34.98" encoding="UTF-8"?>
error on line 1 at column 18: String not closed expecting " or '
@MuhammadRaza 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.
@MuhammadRaza 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.
user3119231
@MuhammadRaza <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
08:08
@MuhammadRaza If you only have that for your XML then it's invalid.
Morning guys
!!tell Zahid Morning
@Zahid Very Good Morning :)
Why thank you :P
Guys I have a question
if(target[0] == "ul#suggestions"){
	console.log("Matched !");
}
else{
	console.log("Did not matched !");
}
Check the this please
well, if target is an array as in ['ul#suggestions'], it will work.
If I console target then it shows:
[ul#suggestions]
How can I compare it ?
08:11
click on "ul#suggestions" in the console
Cause that doesn't work
Are you logging a DOM element?
with your mouse
I clicked it
That's why I wrote 0
@BenFortune I think so.
08:12
Cause that's the index of it
@ZahidSaeed run console.log(typeof target[0]);
@FlorianMargaine it says object
Now how do I compare objects ? :P
@ZahidSaeed you don't. You compare their properties.
run console.dir(target[0]) to get the list of properties
08:15
Thank you guys that worked ! :)
you didn't tell us what was going on.
@FlorianMargaine Last question. What does dir() do ?
I did
I mean what it's abbreviation ?
what's the difference with log()?
ah
I guess it's like dir on windows' cmd
08:17
Log simply returns a string or in other words it prints on the console
directory usually
That means it just returns all the properties and methods of that object ?
Just like windows shows all the files and folders ?
yeah, show the properties of that object like it were a folder in ms-dos
Thank you guys
at least that's how I interpreted it
08:18
You always help me a lot
user3119231
08:45
wow, today it is really quiet here.
08:57
> "Space is big. Really big. You just won't believe how vastly, hugely, mind-bogglingly big it is. I mean, you may think it's a long way down the road to the chemist, but that's just peanuts to space." - Douglas Adams, The Hitchhiker's Guide to the Galaxy
09:24
$("." + message[0]).find(".messages:last").animate({ scrollTop: $(document).height() }, 'slow');

the parent of this div refreshd every 5secs a once, for every 5secs my .message div resetting to top(it not scrolling to bot)but it always scroll or show bottom data
for every 5 seconds it scrolling from top to bot slowly, user feeling bit unconfortable
i tried this
$("." + message[0]).find(".messages:last").animate({ scrollTop: $(document).height() }, 1); --> 1 millisecond, still the animation is like lighting
like a blink very 5 seconds, cant i animate or scroll to bot without user notice
@Simply so set it to something inbetween?
What's your question?
how to potato
user3119231
09:45
is there an free alternative to mercury on xampp
how do you get 'nvm use' to work across terminal sessisons?
@neil i did not get you
@Simply did you have a question or were you just making conversation?
that was my question, i want to scroll to bot but user should not notice it
09:56
@Simply you shouldn't animate it then, just perform the change
oh, can you tell me how pls

« first day (1774 days earlier)      last day (3399 days later) »