« first day (1647 days earlier)      last day (3303 days later) » 

12:08 AM
and c# can be written in a 'functional' way, too.
 
Ugh guys I'm having a really stupid problem. I have gulp installed but my system can't find it. I tried adding to PATH and creating an environment variable called NODE_PATH too.
I'm on Windows 8 (and I can't switch right now)
 
is it installed with -g (global)?
 
aaaand operation ion rover has gone turtle
 
You need anti-turtle RCS thrusters
or a reaction wheel and rock back and forth
 
Yup
 
12:22 AM
@Luggage The reaction wheel I added has exploded
 
stackoverflow.com/questions/9587665/… says it might be in %AppData%\npm\node_modules
hm.. that might not be where is put the executable for commandline use..
 
> I don't want to use locally-installed modules, it's a waste of disk space for me
Lolz
 
heh, yea, that was a bad example
they were require()ing it, not using a commandline app.
I'm not on windows at the moment, so I can't go poking around to see where the files are
 
1:39 AM
Chromium dev tools got some nice improvements recently
console.trace() looks nice and it completes x[
 
1:52 AM
@BenjaminGruenbaum Very nice
I've never worked with a language with contracts
 
2:38 AM
I am using node_redis, anyone have a suggestion for inserting a bulk amount of keys and values? Roughly 300 at a time.
I found LPUSH, MSET, and MULTI but I can't find an example anywhere showing their proper use.
 
github.com/mranney/node_redis#multiexec-callback- client.multi() will let you configure lots of commands and then do them all at once.
 
He probably wants a single query though
 
It will be in a for loop
Send an array of tasks then set it all at once
 
Multi does that. It creates one 'script" based on all the commands you set individually
 
I don't know about key-value stores, but in relational databases that's a bad idea
 
2:43 AM
or you can pass in a pre-made array of commands.
I don't know if 300 is a lot but it's fine with redis. It'll make one 'query' behind the scenes.
 
I can't do premade, @copy In relational I know it's bad, thats why I am using rocksdb but it interfaces through a redis client
 
var multi = client.multi();
for (var i = 0; i < myJunk.length; i++) {
    multi.set(key, value);
}
multi.exec(callback);
that'll build a single 'script' and send it all at once when you .exec() it.
 
Ah, I see, let me give it a try
 
again.
 
hm, Mutli will send separate commands, not one script. I was wrong
 
2:51 AM
I am just looking for a way that will have take the least time, similar to how leveldb has batch
 
is this a rare occurrence or something that will happen very often and needs to be optimized?
if it's rare, multi() should be 'good enough'. Otherwise, you may nee dto look into redis scripts.
rare = not every single request or many times per second.
 
Basically when someone hits send, it will take all the emails of people and create a key and value, where it will then have a subscriber send the email through Haraka
So yeah, every request will have about 300+ sets
 
if redis is local, it'll still probably be so fast as to appear 'instant'.
I also use redis as a queue for processing emails. I use github.com/OptimalBits/bull
@Brandon ok, reading some more. Multi should be fine. it sends uses the redis 'multi', not a script, but it lets you send lots of commands at once. It won't be sending one commands, getting response, sending next
 
sorry to barge in to the most likely wrong chat room but is there any chat room concerning batch files or windows task scheduler? i cant seem to find any.
 
@Jouster500 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.
 
3:04 AM
a chat room? no idea.
 
its one of those major tags here but doesnt have a chatroom for it?
that bites
btw while i am in a java script lobby and most likely have to be facing college here soon, could somebody tell me what this...
 
unlike a major programming languages, people tend to set up the scheduled task and then move on
people don't spend 40 hours / week making scheduled tasks :)
 
morve on, homstar!
 
hehe
 
@if (@CodeSection == @Batch) @then


@echo off

rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"

rem Start the other program in the same Window
start "" /B cmd

%SendKeys% "echo off{ENTER}"

set /P "=Wait and send a command: " < NUL
ping -n 5 -w 1 127.0.0.1 > NUL
%SendKeys% "echo Hello, world!{ENTER}"

set /P "=Wait and send an Up Arrow key: [" < NUL
ping -n 5 -w 1 127.0.0.1 > NUL
%SendKeys% "{UP}"

set /P "=] Wait and send an Enter key:" < NUL
found this nifty bit of code today concerning batch files and java scripts
 
3:07 AM
Anyone else run into the maxBuffer thing in child_process before?
I hadn't
Wasted my morning
 
and i am curious as to how it works
 
cscript?
 
it runs a java script
figured it would have something in common
 
yea, i use it. I prefer JS over VBScript.
and MS has let you script in JS for many many years.
it's no node.js, but it gets the job done.
 
Like i said, im not even a beginner when it comes to java. However it would be prospective of me to look into it and get an idea what is happening
ah well. Im sure i could learn more about it in college. Its getting way to late for me. Later.
 
4:03 AM
 
4:54 AM
guys, I'm confused...
I can't find the source code for the game ludumdare.com/compo/ludum-dare-32/?action=preview&uid=26377
and I'm sure it was written in js
 
right, I could have done that -_-
thanks
in any case, how does it get injected in the page? Now I'm curious about that
 
facepalm
thanks
 
Yep
 
5:19 AM
heh
was just looking at his game earlier
he should put it on Steam
/me tweets him
man he is so good when it comes to the little touches too
his animations/style/sound all top notch
@phenomnomnominal woah havent been to your page... awesome skull!
bleh I need to get out of this funk and start making stuff again.
 
@Loktar thanks! just changed it last week
 
looks kickass man
 
5:40 AM
@SecondRikudo I'm coming to the React meetup today at 6
@Mosho cc
 
@Luggage After a ton of benchmarking and testing, inserting them one at a time over a unix socket turned out to be three times faster then when using multi, it also used about 20% less RAM
 
6:20 AM
Why the fuck are all these people suggesting singletons here? stackoverflow.com/q/29740389/1348195
 
6:34 AM
howtoprogramwithjava.com/wp-content/uploads/2013/01/… the cause and solution to all problems
 
can please have shorthand for console.log.bind(console) type thing
 
var c = console; var log = c.log.bind(c); :)
 
omg thanks just what I was looking for
 
var b = console.log.bind; b(console);
 
I knew I could count on you guys
...to be fucking useless
 
6:42 AM
idk what you mean though
like what do you want
 
to have had a normal childhood
 
that ship sailed a loooong time ago
 
hi
 
@Jkrish 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
 
6:54 AM
wht is your fav. javascript debug tool?
firebug or anything else?
 
I just use whatever's built into chrome
 
k. thts cool
 
good afternoon
i have issue in flipper online readbook.
please help.
 
lmao
 
7:12 AM
Is there a way to enumerate through a object with key value pairs without using for in?
I still need the key and its value, but for in has really low performance
 
for each
 
It is an object though, not an array
 
@Brandon for (let [key, value] of obj) in ES6, or Object.keys(obj).forEach(function (key) { var value = obj[key]; ... }); in ES5. I think for...in is faster though.
What makes you say it has a low performance?
 
Uhh
 
7:18 AM
I am looping through roughly 1M key value pairs
 
@Brandon That's not exactly fair. Filter out the prototype inherited values.
And even then, you're not doing any work
How can that ever be reliable?
 
Yeah I wouldn't worry about the speed of the loop part
 
@RoelvanUden Wouldn't that involve removing the key though?
 
Maybe look at the lodash source on github and see how they do it?
 
It's probably going to be a for in
I think that's what most people use
 
7:24 AM
@Brandon Nah. for (var key in obj) { if (obj.hasOwnProperty(key)) { var value = obj[key]; ... }}. Like that.
 
@Meredith Well, it seems that github.com/lodash/lodash/blob/master/lodash.js#L9724 uses either keys if supported or shims it with github.com/lodash/lodash/blob/master/lodash.js#L4433
 
@RoelvanUden Hm, I will take a look at it tomorrow I guess, it's time for bed
 
That's one way to do it I guess
 
But I only had a brief look
 
Does Object keep track of keys on insert/remove? or does keys generate the keys when it's called?
If it's the latter then don't use it
90% sure it just keeps track of it though
 
So it uses a loop internally anyway
 
Spec doesn't really say how to implement it though, just what results it should produce
 
Yeah I'd avoid using keys for this purpose
It's fine for when you're not looping over the keys
But you're just doing twice as much work if you are
 
I'd use it
1) microoptimisation
 
Microoptimization is a bullshit reason
 
7:31 AM
2) it's possible that V8 recognises Object.keys(...).sth(...) anyways and skips creating the array
 
There are times when microoptimization is dangerous but this isn't one of them
 
3) or at least realises that it can cache the array. Across all instances of the same class.
4) hasOwnProperty is ugly and most people leave it out. Object.keys is safer in that respect.
 
If a method doesn't offer any benefits over another method, you don't use it
 
Readable code
 
And possible future native optimizations
 
7:34 AM
I'd say Object.keys(...).forEach is more readable than for(el in obj). Is el a key, or a value?
 
That's on you
 
Does anyone know if the "places" you give candidates actually matter? Or do they all have the same weight for the tallying?
 
Also, that. Object.keys().forEach has a greater chance of being parellelizable by the compiler
@Kippie They do. Look up "single transferable vote"
 
I still prefer a loop for an actual... loop. Object.keys be damned.
for..of is lovely.
 
for..of is not here yet
 
7:40 AM
Babel, TypeScript :-)
 
I don't want to compile my userscripts/bookmarklets/quickhacks
 
Neat
Then you can use for in
 
... or just use for..in over plain objects only, and not need hasOwnProperty. I, for one, I am not worried my kata solution finishes a few miliseconds later than absolutely necessary.
... or my DOM manipulation thingie
 
We were talking about a plain object
 
I think this discussion started with someone having to go over 1M keys though
 
7:46 AM
morning
 
An object with 1M keys??? How?
 
Which means it might be an XY problem
 
What
 
29 mins ago, by Brandon
I am looping through roughly 1M key value pairs
 
I'm curious about that use case...
 
7:48 AM
Probably analyzing a database or something
 
In Node?
 
Sure
 
Let's all hope this is in Node and not in a browser
 
Google Chrome is not responding
 
It never is
Once I had I was working with like 1M numbers in a single array. It still took ~~100ms. As long as you don't want to do that every frame, you are fine. I had to do it in every frame.
Finally I opted for a coarser and faster simulation
Perhaps I should return to that and use it as a benchmark for functional/iterative loops and flat/nested arrays
 
8:15 AM
Hi there, is there a way to add a CSS style to all "path" elements plz ?
 
@Luckyn 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.
 
"path" elements?
 
svg
 
yes
 
And yeah there should be
What have you tried?
 
8:16 AM
some <path> in my svg
I know I can add to a specific element with getElementById(...).style
 
Don't do that
What have you tried with css?
 
Then yes, It's possible as long as it's an inline SVG. Use CSS to add CSS styles based on CSS selectors.
 
I can't do it css only
it's a button wich make the change
 
Apply a class using javascript then
Don't touch the style property unless you know what you're doing
 
k
but is there a syntax to catch all element of type path and add a class to them ?
 
8:19 AM
Set a class to a parent
 
That's one way to do it
If you want to select all path elements, then use querySelectorAll
 
Also, it's horrifying to hear "a syntax to ..."
 
sry :/
 
or getElementsByTagName
 
k, i'll try that, thanx :)
 
8:22 AM
surely you could have typed "ks" instead of "x"?
 
Be cool
 
Qui, moi?
 
You don't have to neckbeard all over him lol
 
always do that misstake because of the "thx" abbreviation >.<
 
ah.
 
8:32 AM
Mornin
 
Morning!
 
THE
in window resize, I am reszing 10 divs, won't they keep calling window re-size method 10 times then ?
 
Why should they?
 
THE
how can we make sure div resizing in window-resize method don't trigger it
because they are resizing...
 
Why should it?
 
8:37 AM
(hint: window resize fires when the window is resized)
 
THE
does it has to be in document ready ?
!! google does window resize has to be in document ready
 
why should it?
 
Sounds like you're missing some of the basics
Like how events work and when code is executed
Just read through a good guide on it and you'll understand it
 
THE
events get in a que and then executed one by one...
 
8:38 AM
sure, but...
 
THE
with JS you are never sure until you add deffer.. or somthing like to make sure methods get triggered first
 
... or just react to events as they come?
 
THE
:S
!! google should I call window resize in document ready or its best to leave it outside it
 
Are you learning javascript on your own?
 
THE
8:42 AM
@Meredith yes
i forget most things after 2-3 months, so i have to keep revising
 
Ok, so googling problems as you encounter them is good, but it doesn't teach you the holistic knowledge you need to be successful
Take the time to read some text on javascript
 
@THE Do you remember your name?
 
I recommend speaking javascript by rauschmayer
But there are a lot of good books out there
 
All you really need is the base understanding of the language and environment, as well as the capacity to read documentation. The details are trivial and can be searched at any given time. Until you've got the basics down, you'll keep forgetting.
Focus on the basics. This is why formal education is all about the why/how and not about APIs and shit.
 
s/is/should be/
 
8:46 AM
It is
Unless you went to a really bad school
 
THE
@JanDvorak nope, it's not that bad, its only specific to complex topics or so
 
The saddest part is, some managers do think formal education is about APIs, and complain that uni grads cannot use any practical API.
 
THE
124
Q: JavaScript/JQuery: $(window).resize how to fire AFTER the resize is completed?

sarahI'm using JQuery as such: $(window).resize(function() { ... }); However, it appears that if the person manually resizes their browser windows by dragging the window edge to make it larger/smaller, the .resize event above fires multiple times. Question: How to I call a function AFTER the brows...

issue with jQuery is that you can't be 100% when your code is executed without adding timeouts
 
Don't use jquery until you can convince me that you should use it
 
@Sheepy You've really singled out the wonderous group; managers.....
 
8:47 AM
@Meredith I've read its source code
 
How'd that go for you?
 
THE
@Meredith i don't like but am nearly done, can't go back
 
I spent the following months in a psychiatric hospital
 
You can keep using it for now
 
strapped down?
 
8:49 AM
But jquery isn't great for learning
 
hey guys
 
Hi :)
 
why? it's great and does all things
 
I think jQuery is pretty well written. I still consider it one of the best source code I have read.
 
!!s/learning/anything
 
8:49 AM
@BenFortune That didn't make much sense. Use the !!/help command to learn more.
 
@Sheepy really?
@Sheepy you were never lost in the myriads of nested ternaries?
 
JQuery is poetry
 
Is it really that bad?
Nested ternaries?
 
That's to aid minification
 
I remember reading 3-4 nestings...
often to handle the arguments
 
8:51 AM
I don't even like using one tern
 
because jquery likes to have one method that does ~36 things depending on the arguments
 
@FlorianMargaine Really, yes. Well, I like compact logic, so I'm quite used to them.
 
convenient!
 
@Meredith no, one ternary is often great
 
I have trouble reading them
 
8:53 AM
@Sheepy do you work in php?
 
I use them pretty sparingly
 
@FlorianMargaine I do. And Java. And .Net. And SQL. But I don't do OC or Swift... for now.
 
@Sheepy be careful with nested ternaries then :)
 

« first day (1647 days earlier)      last day (3303 days later) »