« first day (2054 days earlier)      last day (3117 days later) » 

07:00
@Shea you say that like it were a bad thing
@Abhishrek Show off ;)
you're not fooling me, terminator
@Shea I am not! Just avoid any logical contradictions or otherwise similar discussions
07:18
well that was a fun bank holiday, with a cold the whole time
guys. must myEmitter.once('newListener') be added at the beginning of the code before others like myEmitter.on('event')
i tried it in console, and it only works if added before and not after.
const EventEmitter = require('events');
const myEmitter = new EventEmitter();
myEmitter.once('newListener', () => {
	console.log('lalaa')
})
myEmitter.on('event', () => {
	console.log('A');
});
running this console.log(myEmitter.eventNames()); produces output
lalaa
[ 'event' ]
[Finished in 0.2s]
yes, it needs to be before the event declarations you want it to trigger for
however using once for newListener doesn't make much sense to me.
well, at least it doesn't seem very practical
07:33
@Shea ah right. the original example for using once was this
myEmitter.once('newListener', (event, listener) => {
	console.log(event);
	console.log('-------------');
	if (event === 'event') {
		myEmitter.on('event', () => {
			console.log('B');
		})
	}
	console.log(listener() + '----');
});
due to did not want to call infinite loops.
as per the docs.
thanks for the clarification.
@Ming wtf happened to your face?
@JanDvorak what did you mean my face. lol.
thats a dog.
1 message moved to Trash can
@KamilTomšík Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
What are the chances that this will eventually make it into ES standard?
(it's currently stage 1)
class Xyz{
  static prop = '...';
}
none I hope
07:39
@Shea ok, so what's a better way to initialise static member along with a class? a decorator?
isn't it already?
oh, nvm
no, it's only in typescript...
not static
there's no good reason for static in JS
in ES5 it was easier since there were no classes so we could just define factory...
(() =>{
    var static;
})()
07:41
@KamilTomšík you can still do that :P
idk I just don't like it for some reason
@towc sure there is... If you have something which is related to all instances but don't want to make it available on prototype.
ES6 and 7 are going to be backwards compatible
yeah, I don't like it too - but I also don't want to use custom class factories from ES5 ages when the rest of app is in ES6...
@KamilTomšík say that your constructor is Constructor, then you just do Constructor.staticVariable rather than Constructor.prototype.differentVariable
07:43
@towc yep, I can do class Xyz{} and then Xyt.staticProp = ... - but the point is that I really want it to be at the top of the whole file (which is not possible with ES6 classes) - my concern is readability
function Constr(){
	this.a = 1;
}
Constr.prototype.b = 2;
Constr.prototype.incrementSharedVariable = function(){
	++Contr.c;
}
Constr.c = 3;

var x = new Constr,
    y = new Constr;

x.incrementSharedVariable();
y.incrementSharedVariable();

Constr.c; //5
@KamilTomšík well then sucks to be you
there's no good reason for it to be readable from on top
anyway, g2g
so let's make it more concrete - basically I'm trying to model jqueryui widget factory, or backbone view... And I want to define default options - and I really want to show them at the top of the file since everything is related to it...
@towc ok, thx anyway
I usually use const for default values
@KamilTomšík Why not?
Aside from imports, what's stopping you from having whatever you want as the default options?
user3119231
@GNi33 o/
07:59
It's mostly because I also want to be able to check if I'm not passing something which does not exists. I'll show some code in a minute, thx for your feedback :)
Jquery and backbone. It's like a B-rated horror flick
\o
Hello..I really don't understand eval() functionality. Can any one give me a link which explains about it..more deeply. thanks!
@darla_sud Welcome to the JavaScript chat! Please review the room 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.
@GNi33 o/
08:05
@darla_sud If you aren't absolutely sure you need it, you don't.
@darla_sud don't use eval. That is all you need to know for now
class Button extends View{
  init(options){
    super.init(options);

    this.text = options.text;
  }

  ... setters, mutators, etc...

  render(){
    this.$el.text(this.text);
  }
}

Button.template = `
  <button></button>
`;

class View{
  constructor(options){
    this.init(options);

    this.$el = $(this.constructor.template);
    this.el = this.$el[0];

    this.render();
  }

  init(options){}
  render(){}
}
When you know why you shouldn't use it, you'll be allowed to use it ;)
but it simply eliminated the complexity of calculator function.
1 message moved to Trash can
@darla_sud Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
08:07
function calculate_this() {
  var input = document.getElementById('numbers').value;
  var results = eval(input);
  document.getElementById('results').innerHTML = results;
}
Morning
This is something which kinda works (simplified example) but my concern is now that I'd like to avoid doing this.text = options.text || '' and so on for other defaults, and I'd also like to check if I'm not passing non existing option (to catch typos early)
Guys, say I want to make a node.js script executable
For a git hook
@darla_sud user can run anything that way
 var $table = $('<table class="example"/>', {
                append: rows,
                appendTo: $('#Container')
            });
08:09
What do I put in the shebang?
what's wrong with above ?
It's not necessarily /bin/node since nvm is a thing
appendTo doesn't seem to be working :(
!!jquery appendTo
@MadaraUchiha #!/usr/bin/env node does not work?
@Mathematics ^
@KamilTomšík Could be. I suck at linux scripting of all kinds.
@MadaraUchiha I already read it, I also tried this, but it doesn't work
                appendTo: '#Container'
@Mathematics Did you? Because your example doesn't reflect that...
@MadaraUchiha I can't be 100% sure since I'm on OSX but this is what npm packages do for ./node_modules/.bin/* files (and those are executable)
@MadaraUchiha can you use npm run?
08:12
@Mosho No. Git hooks.
@MadaraUchiha I didn't added all of the scenarios I tried :(
I just don't want to use bash for it.
@MadaraUchiha you can use npm run in git hooks
@Mosho I'm not guaranteed to have a package.json
I see
08:14
Also, I know I can also easily do something like
#...bash

node foo.js
But that sucks.
You can get hookers in npm run
@MadaraUchiha #!/usr/bin/env node
That's what I use anyway
cd: not a directory: /usr/bin/env/
asvd.github.io/intence this is really cool
2
@MadaraUchiha ok I figured out the issue myself... it doesn't like me adding class to table while appending
08:17
@MadaraUchiha it's an executable, not a directory
@FlorianMargaine I am an idiot.
yes, you are.
Figured that out at exactly the same moment :D
it's ok, brainfarts happen
@FlorianMargaine I agree
08:20
Could anyone say why this doesn't match _aze_ (last line in data): regexr.com/3dhbp
@deostroll it does
okay, _media_azure_fasts_aarez_aze_ it doesn't match...
@AwalGarg Interesting
but for _media_azure_fasts_aarez_laxe_aze_, it does...
@deostroll The leading _ is already consumed
08:24
yes...I get that now...
@SomeGuy man, krypton level 3 was fun :)
what if you wanted to match words 1 to 5 in length?
@deostroll I don't understand the question
{1,2,3,4,5} ?
@deostroll {1,5}
08:26
@deostroll /1 to 5 in length/g
It's min,max
ah okay
@AwalGarg That reminds me of a user we recently had in a support call, who didn't know if they had a mouse wheel
@OliverSalzburg you should have told him to feel around for mouse balls
08:37
@Neil I wasn't in the call. I just got the report. Must have been pretty crazy. Our guy had to explain to her what a mouse wheel is and where she could find it. Turns out, she did have one and was amazed by it
user3119231
@OliverSalzburg I bet there is more "pc related" stuff what I can show her.
user3119231
strikethrough the what
@OliverSalzburg I should try that someday. No, I don't have a mouse. I have a trackball. Two, in fact. The left hand one is the main and is bigger. Don't you think it is quite insensitive and politically incorrect to call scroll wheels "mouse" wheels? And please help me find the "middle button". The balls each have four buttons, located evenly on N, S, E, and W.
@OliverSalzburg tell her that it is not a coffee mug holder while you're at it
08:46
I use the mouse in front of me as a hand rest. Isn't that what it is for?
Hmm. I am also using computer sticks as monitor stands (boxed) and cables as paper weight.
@AwalGarg Can't drag scroll :(
09:05
A user while becoming moderator, need to fill any form?
@Sheepy something like this
http://i.imgur.com/k0sepXP.jpg
I use my secondary laptop as a monitor stand
@doug65536 Your solution is excellent and seem to be working, thanks :)
there is one logical thing though, if 2 object have same column names, it will ignore them
Can someone tell me why this code throws the following error?
Using React & Trying Redux

import React, { Component, PropTypes } from 'react'

class Counter extends Component {
    constructor(props) {
        super(props)
        this.incrementAsync = this.incrementAsync.bind(this)
        this.incrementIfOdd = this.incrementIfOdd.bind(this)
    }

    incrementIfOdd() {
        if (this.props.value % 2 !== 0) {
            this.props.onIncrement()
        }
    }

    incrementAsync() {
        setTimeout(this.props.onIncrement, 1000)
@cswl Can I have a cute wolly mammal instead of a hairly arachnid? Q.Q
09:11
@elsololobo that's a lot of code to paste in chat, why not use pastebin or fiddle ?
@Mathematics good point
@SterlingArcher omg how was it?
could this cause because of some missing npm package? Cause it´s from the example git of redux and I currently trying to import it to my example project
function hello (who = 'world') {
	alert(who);
};

hello();
@KamilTomšík ^
09:23
hey guys. i seem to get inconsistent results when writing to a file.
I'm writing a sentence 1000 times. but the order of the sentence is off. any ideas?
var fs = require('fs');
var writable = fs.createWriteStream('readFile.txt');
for (let line=1;line<1000;line++) {
	var sentence = 'this is line ' + line + '\n';

	fs.appendFile('readFile.txt', sentence, (err) => {
		if (err) throw err;
	});
}
console.log('it is done...');
for example
this is line 1
this is line 2
this is line 5
this is line 4
@Ming Put all lines into one big string before writing. Once.
From API documentation: "Asynchronously append data to a file, creating the file if it does not yet exist."
Because fs.appendFile is asynchronous.
@Sheepy @littlepootis alright. thanks. now i understand.
I want to give Caprica another chance. How does it sound guys ? ^^
@BadgerCat If you're online, Can you post this: !!summon 53839 ?
That is just for testing purpose.
09:29
She's the one who dumped you, bro..
@TheLittleNaruto futile
Hmm.. Still
I have great affection for her..
why does appendFileSync take so much longer than appendFile ??
Can't resist it :(
writing 1000 lines takes 15 seconds.
09:30
With appendFile?
appendFile just takes 1 second
appendFileSync
Probably because the former is synchronous.
but how does synchrouns make it longer?
var fs = require('fs');
for (let line=1;line<1000;line++) {
	var sentence = 'this is line ' + line + '\n';
	fs.appendFileSync('readFile.txt', sentence)
}
Each appendFileSync waits for the previous to finish.
oh you mean appendFile is doing multiple at once?
i think i get it.
but if i understand correctly, in nodejs, only 1 thing can be running at any one point in time?
since there is nothing else on the queue, except writing to the file, how could sync be much longer?
09:36
Hi
@Ming Because of the code that is being run when you execute that function
@Ming It is slower simply because your main thread - the "one thing" - is waiting on sync.
anybody here who have worked on canvas??
I/O usually includes waiting for stuff
@Learning I've made some performance tweaks, why?
09:38
@JanDvorak:Because i am working on canvas with creating some circles and making animation with it
See this question:
thanks for clarifications. i sort of get it now.
@Ming and if you concat a big string, pass it to file in one go, then you get the best of both worlds. (in this case)
3
Q: Update html canvas tag on every ajax request with new data

LearningI want to update my canvas on every ajax request if new user is found or there is new connection of existing users. I have users and connections between them: var data=[ { "Id": 38, "Connections":[39,40], "Name":"ABc" }, ...

@JanDvorak:but my animation is not working with ajax call
Uh oh. I didn't expect people to create circles. Most people just reuse the same few circles again and again.
@Learning I would close that for missing code but no, SO won't let me.
@JanDvorak:Why you want to close it
I have put everything like my whole code in it
09:41
@Learning Why is 1 web service and ajax call to my web service marked as code?
You should have invested more time into writing a proper question instead of putting a bounty on it :P
You should put the code in the question.
@Ming I always assumed there was a lot of OS related things you won't have to wait on with async
but putting lots of code in the question would make it look dirty
someone with massive knowledge of JS ?
What's JS?
09:43
@JanDvorak:You have downvoted the question right??
John Sanders
Jester Spectres
@JanDvorak Jee Sir
@Shea ah never crossed my mind. yeah that makes sense too. Thanks for that clarification.
Jumping Squid
09:45
!!live
@JanDvorak You do not have permission to use the command live
Jerry Springer
ur rewd Cap
@AwalGarg That's nice, but why does it slow the page down so much?
Juiced Salad
09:45
!!summon 53839
Job Security
@TheLittleNaruto nothing happened?
Jury School
!!live
@BadgerCat I'm not dead! Honest!
09:48
@Ming well I mean, it was always just an assumption I had...
I wonder if it would be as big of a difference on a SSD rather than a HDD
Anyone plays Neko Atsume?
@OliverSalzburg:I have marked that as code just to gain attention on that line.although i agree that i should have make it bold
!!hammertime
STOP
HAMMERTIME!
Not all my math jokes are bad. Just sum.
09:52
That's a pun, not a joke.
pun; a joke exploiting the different possible meanings of a word or the fact that there are words that sound alike but have different meanings.
check and mate
@cswl at least I thought it was pretty punny
leol.. lol.
but jokes are supposed to be funny... that was hardly any funny so..
latest Firefox versions removed strict-mode "error" when you define a function within an if-clause or switch or whatever
09:55
@jAndy The Game
@cswl it's a pun, what do you expect?
This is the most evil piece of script ever written...
I lost
As far as puns are concerned, that was decent imho
@cswl shots fired
also, is that a fact?
user986408
09:59
does anyone know where i can get a good list of tech tags (like on stackoverflow) for use in my own projects?
how to modify an object's property name ?
I can change property's value like this
result[key] = value;
but how can I change result[key] = result[key's new name] ???
@cswl I never claimed to be the one that thought it up, but I am flattered that you checked
@Neil you stand accused of plagiarism
I stand anywhere ?
@Shea I stand before you a guilty man. I therefore must be punished
10:04
@Neil your punishment is to answer my question :P
@cswl this is a case in hand, if you can produce proof that you own the copyright on said joke.
Obvs if you know how to...
@Mathematics you can't rename, but you can create a new property and delete the old
@Neil ouch, that's painful
Hey guys, need help with this question..
10:06
@Mathematics why?
@Neil because it sounds dirty :(
I guess that was on public domain.
delete result[key];
result[key + "." + tableName] = value;
well above doesn't work either
@Mathematics order.. what do you assign after the value is deleted?
user3119231
someone here good in drawing?
10:10
@Mathematics and yes, it is dirty. It is a sign that you are not doing something right
@Neil I am deleting property not value ? I am calculating value from somewhere else, hold on I think I found the issue
@Neil you are most welcomed to suggest something better :)
0
Q: How to add object name to table columns

MathematicsI am receiving JSON array, flattening it to display it as a table, but this logic I am using has a flaw, if my object have same column name it will ignore it and will only add first column it finds. Problem I am trying to solve Display nested objects into a flat table Problem I am stuck at I ...

@Mathematics it would be a conceptual problem, meaning that I would have to rewrite your program to fix
@Neil Yes, it is, but it was written by @doug65536
I am just trying to fix the issue, I am pretty sure a simple fix should do the job, but my knowledge of JS is limited
You are not exactly new to this room. I think this is not a JavaScript problem; this is conversion of data structure and is a generic programming problem.
@Sheepy yes but it's related to JS @example, I tried another way of doing but I was stuck there as well too
10:17
i follow this tutorial to get data as binay in javascript
if I was a advanced JS user, I would choose simply the best logic
as this part
    $.ajax({
  url: "/my/image/name.png",
  type: "GET",
  dataType: "binary",
  processData: false,
  success: function(result){
	  // do something with binary data
  }
});
@Mathematics I mean this is not as much as a problem of limited js skill, but is limited by programming skill / experience.
where its writen do something with binary data, i just want to download the zip file
how can i do this in js ?
sorry guys maybe stuped question but am not so much into javascript
@Sheepy off course it is, I can write an algorithm to fix the issue, but it won't suit JS, but workable in C#
10:20
@Mathematics Can you elaborate? How would you solve it in C#?
@Kob_24: The duplicate I marked your question as, should have answers that show how to convert javascript binary data into a download.
@MadaraUchiha inefficient implementation, I guess.
It is just a proof of concept, really. It is more about the UX idea than about the JS lib itself.
its not workign bro i tried it :( @Sheepy
@Sheepy problem is solved, just stuck at the last bit, I am not sure why you want me to explain all bits of code :(
@Kob_24 do you really need the binary, or do you just want some way to download an image when you click a link?
@Sheepy let me try flat library you mentioned
10:25
/me AFK, over phone
@Mathematics if I understand correctly, result[key] should be an array of values.
or key needs an index/number in it.
@BadgerCat Caprica is buggy now. It doesn't work. May be it has room limitation.
@Mathematics Your problem is that, when you flatten the objects, you also lost the "object name" that you want. A lost of information. So you need to rewrite your code to preserve that information - either in a separate dataset, or use a flatten scheme that keep the structure.
@Sheepy how about following your suggestion :)
getting closer
@Shea I think I am getting closer now
Definitely getting closer :D
Sorry I got to go now. Good luck~
10:30
@Sheepy sarcasm ? :O
@BadgerCat She doesn't respond to commands but she did got summoned there.
!!summon 53839
@Mathematics No. Honest. :)
@TheLittleNaruto I will appear in that room after 1 more invocation(s)
@Sheepy ok thanks
@CapricaSix What ? You're already there.
10:31
@Mathematics that poor allocation of internet :(
@Shea i dont need the binay i just need to download the zip file
zip file is returned from api as binary data
and i just want to download it
@Kob_24 what do you think a zip file is?
binary data bro
I see a PNG file though. You're trying to put the PNG file inside a ZIP file and then download it?
If anything, the mime type is wrong
10:33
> "/my/image/name.png"
@Shea sorry I didn't get you
no no no
@Shea on the backend part there is readme file and index.html file are added to ziparchive and are returned as binary to the client
oh, but what's the purpose of the ajax?
simply browsing to a zip file usually starts a download
Wait, you're trying to download a zip file via ajax request?
You can't download a file that way
I was gonna suggest simply using the download attribute for a PNG image, but you shouldn't even need that.
10:39
@Neil ok, I fixed it :)
@Mathematics good man. I can't really check it, but I!am confident that it is better than before
@Mathematics how long have you been trying to solve that, and is there a deadline?
hmm ... I am confused
@Shea why would that matter :)
@tereško I am Neil. Pleasure to meet you
10:44
just wondering
if you're just learning how to code or doing this particular thing as a hobby, I was gonna suggest challenging yourself to do the same task over again from scratch, on fresh mind a later day.
hopefully that doesn't sound rude, I mean it can just be a good exercise
11:00
posted on May 31, 2016

I am increasingly of the opinion that the general software engineering adage “Don’t Repeat Yourself” does not always apply to web development. Also, I found that web development classes in CS academia are not very realistic. These two problems turn out to have the same root cause: a lack of appreciation of what browsers do to software development. Browsers, to misquote Dougl

user3119231
11:10
@Kob_24 If you are still interested to know how to realiza a zip download ping me
@Maurice i am
user3119231
You need to create the zip file on serverside, save it to a folder and return the path (link) via ajax response to the client. Then just do a window.location = path.
So I'm getting reports that users are unable to enter phone numbers into some people's records, because there is already a phone number entered, which can't be removed. Turns out they're talking about the placeholder O__o
Supporting users like that is worse than supporting old IE
Hey, hope someone can help me here. I´m trying React & and previously I wrote my Components like export default
React.createClass({})
with
getInitialState: function () {
            return {
                newUsername: ''
            }
        },

But now I want to do it with the class syntax. How do I have to write the constructor
to initialise the newUsername value to make this component working?

import React, { Component, PropTypes } from 'react'

class FormInput extends Component {
    constructor(props) {
currently it throws: Uncaught TypeError: Cannot read property 'newUsername' of null
11:33
@ssube aah. It took me a while to comprehend it.
@Abhishrek what isyour new job? (ie what are your tasks )
that is madness
yeah, some responds are funny
user3119231
hell, that is user friendly
tried that already
doesn't rexognize "9" well
It only recognizes one form, and the form for a nine is off-screen
no gud implement
no flexible
someone turn this into a npm module
an*
user3119231
11:52
could be a three as well
god damnit
I lost the game.
As taken from the last rule of them all.
Asked a girl for a number... she gave me zero.

« first day (2054 days earlier)      last day (3117 days later) »