« first day (1294 days earlier)      last day (3671 days later) » 

11:00 AM
hey can someone recommend a good javascript book for beginners with a design background?
 
guys, if I need to code an automatic task on a site that requires openid or openid-like (user/password) login, should I do a server script, a chrome extension or there are bots also, any advice?
specifically mql5.com/en wanting to login, then fetch my accout data
 
@kwak uh, that depends on what you want that to do. Chrome extensions are, surprise, dependant on Chrome. Do you want that user interaction? And scripts are nice since you can just put them into cron or the likes, but they require you to authenticate etc which isn't always great.
There's no "this is better"...it's situational. You decide.
 
11:16 AM
It is normal to use the term dictionaries when referring to object literals?
 
If you mean the syntax then it's wrong. But the notion of objects do indeed fall in the term dictionary.
A hashtable is a map, associative array, dictionary, ...
 
Like, i'm doing ({}).isDictionary()
 
isObject is "better"
 
Object.prototype.isDictionary = function() {
    return true;
};
there's not much point in js
 
4..isObject()
I wonder if it's actually possible
Since this is always an object (or null or undefined)
 
11:26 AM
!!!
 
@Zirak what is?
 
Object.prototype.isObject = function () {
    'use strict';
    return this === Object(this);
}
 
Having isObject on Object.prototype
hrm
 
But setting it on a prototype is kinda pointless unless you define it for all types.
 
@OneKitten You're right, I overlooked that
@Oleg Hence putting it on Object.prototype
But it doesn't handle the undefined and null cases.
 
11:29 AM
@FlorianMargaine that wouldn't work
 
@Zirak :(
 
this !== null &&  === Object(this);
 
how else are you going to make it work with your syntax?
 
I prefer is.object(foo);
 
Object.isObject would be better design
 
11:30 AM
why?
 
null.isObject
 
@Zirak yeah...
this !== null
?
 
Run that....
You can't try and read properties from null and undefined
 
typeof null
"object"
Object.getPrototypeOf(null)
TypeError: Object.getPrototypeOf called on non-object
gotta love it
 
@Zirak so why are you saying null.isObject?
oh
I'm using coffeescript
so i just use the ? ;)
 
11:32 AM
Yeah the typeof null is a bug, it's not really an object.
 
lol I just remembered: github.com/olegskl/is.js good old times
 
But it really does annoy me that js is so close to being pure OO
 
@Oleg: those caps... they annoy me.
 
Why do we even have primitives? Why can't everything really be an object? Why can't we access things on null and undefined?
 
is.Object = function (variable) {
    return variable === Object(variable);
};
heh
 
11:34 AM
but can on true and false
 
@Zirak yeah, boxing on null/strings/numbers should be by default
 
It's that retarded Java load, same reason we have that retarded new and func.prototype...
 
@FlorianMargaine that's how Underscore does it afaik
 
That's how it's usually done
 
hey all, newbie here. What do most people use "switch" for? For simple text based games?
 
11:36 AM
@FlorianMargaine That fails for arrays :/
 
@Connor arrays are objects
 
!!> t = []; t === Object(t)
 
@Connor true
 
@redshift People use switch because they haven't heard of dispatch tables.
 
..that'll be me.
 
11:36 AM
or "truth tables"
 
@Oleg I know
or dining tables
 
In computer science, a dispatch table is a table of pointers to functions or methods. Use of such a table is a common technique when implementing late binding in object-oriented programming. Perl implementation The following shows one way to implement a dispatch table in Perl, using a hash to store references to code (also known as function pointers). #define the table using one anonymous code-ref and one named code-ref my %dispatch = ( "-h" => sub { return "hello\n"; }, "-g" => \&say_goodbye ); sub say_goodbye { return "goodbye\n"; } #fetch the code ref from the tab...
 
wait
meh, fuck me
 
It's an object of functions.
@FlorianMargaine Who are we, your wife?
 
@Zirak depends. Did you have sex with me last night?
 
11:38 AM
...you don't remember? :(
 
!!did Zirak have sex with Florian last night?
 
You said...you said...you said you loved me
 
I'm afraid I don't, Bob
 
@Oleg Not a chance
 
Fuck
ABORT MISSION
 
11:39 AM
I love that comic
 
Te eagle has the moose, I repeat, the eagle has the moose
Switch to plan B!
 
hits FlorianMargaine on the head with a bucket
 
!!does Zirak have sex with those blow up dolls?
 
@Connor Of course not
 
11:39 AM
runs
 
@Zirak dies
 
Why are we talking about sex all of a sudden?
 
Because of you, gorgeous.
 
It's all Florian's fault!
 
am I the sex offender?
 
11:41 AM
you wish ;)
 
hm, no?
 
Show me on the doll where the bad man touched you. Yes... m-hmm... ok... ugh, just show me on the doll where the bad man didn't touch you.
 
touches foot
 
Well that rules out foot fetishists
 
only people on the internet have foot fetish anyway
 
11:45 AM
mandatory "your mom" joke
 
Everybody's on the internet. Your statement is meaningless.
 
.... you're?
 
OOOHHHH SNAP
 
M'y typing is terrible
 
11:46 AM
I just woke up, stfu
 
Now we only need Jan Dvorak to do that, and we win
 
I don't mean anything, but it looks like this was pinned.
maybe it's Zirak.
not snitching or something.
 
Totally.
 
function "+" (Left, Right : P.T) return P.T renames P."+";
ada has some weird stuff
 
yeast infection?
Poor Ada
pin drops
 
@Hawk 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.
 
 WHY SINGLE-THREADING IS A GOOD IDEA
       A short list by Zirak
=====================================
    1. Fewer race conditions.
 
Knock knock. Race condition. Who's there?
 
It's the best not having to run two lines of code at the same time.
 
Race conditions are sooo 1860 southern USA.
 
12:15 PM
Sometimes, you make me sad
So, the weather
 
@Zirak but, I have four CPU cores
 
thats priceless
 
7 mins ago, by Zirak
Sometimes, you make me sad
 
@Zirak i have 6
 
You must be very proud
 
12:26 PM
nope.
want 12
 
Glue two together
 
or buy a one with 12 cores ?
 
But you already have 6. Save half the price.
 
@JanDvorak multi threading doesn't exclude multi process, fortunately!
no wait, that sounds wrong
 
@FlorianMargaine way to go. I do like the worker model
 
12:33 PM
> Moresh the Exile, lover of raw spider legs, until he died of poisoning in 1121 AE.
 
lover of... raw spider legs?
 
Cooked spider legs, on the other hand, are a worldwide sensation.
 
12:50 PM
@Zirak What did I just read?
 
@Dudeson 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.
@reverse_engineer 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.
 
1:17 PM
hello guys
 
..
dead
 
@Elfayer 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 have question regarding mongodb?
 
You look surprised.
 
@Zirak I'm trying this fun thing github.com/makinacorpus/spynner
 
1:28 PM
You must be thrilled.
 
@Kingisback That's not a lot of information, but I'm guessing the answer is "Yes, you do have a question regarding mongodb"
Don't ask to ask. Just ask.
 
would highcharts defaults get overriden anytime you change that key? For example:
highcharts.setOptions({
  plotOptions: {
    click: function() { do things })
  }
})
chart = {
   ... //stuff here
   'plotOptions': {
     'allowPointSelect': true
  }
}
 
I'd have to assume "yes", but I have no evidence or experience to back that up.
You should try it
 
I'd assume "no"
 
1:42 PM
I'm not sure if it will 'add' to that key, or delete it completely and make it over
 
(Promises)
while you maybe? read i'll go refresh my coffee
 
@RyanKinal yep i have password change functionality in my app.In password change page ,i let the user to put his current password and then new password.Now when user is typing in current password field on every keypress event i use each letter of the field and make a mongodb call till right it matches.At match i get 200 .I'm wondering wat about those call which didnt match and for them i getting POST localhost:3000/checkcurrentpassword net::ERR_EMPTY_RESPONSE?please help regarding this
 
Yo bitches was up
 
@rlemon
return foo().then(function(fres) {
    return Promise.cast(fres).map(function(item) {
        return bar(item).then(function(state) {
            return { item: item, state: state };
        });
    }).then(function(arr) {
        res.render(page, { arr: arr });
    });
});
 
awesome
I'll review this
finally hit my first point where I needed promises and couldn't hack my way around them
 
1:52 PM
you need to make foo and bar return promises though
 
what would that look like?
 
what I showed you ^
see: return foo().then(...
 
You can do that without promises, you just need a tweaked forEach. Some async libraries provide just that
 
@rlemon you can always hack your way around promises
 
maybe I just need a smoke and finish this coffee :P
 
1:54 PM
it's 4pm
it'd be time.
 
foo is a db call, returns rows. bar checks to see if the port is listening
fyi, if you cared
 
We don't
2.9 you
 
just for that I am sacrificing exactly 3.7 ducks.
ugh
 
@rlemon how's foo written?
 
anyone pls help me
 
1:56 PM
no
 
Go ahead, they're your ducks
 
@rlemon don't forget you can use Promise.promisify
 
module.exports.foo = function(cb) {
  pg.connect(connString, function( err, client, done ) {
      client.query(qs, function( err, res ) { done(); cb(err, res); });
  });
  pg.end();
};
@FlorianMargaine this is my first time using promises. I know nothing :P so I haven't forgotten, I just don't know :P
 
in a highchart point click event, how can you check that a key exists within the chart?
 
I created a simple application in c# windows application. here I am just read the content from xml using jquery. but its not working. but it is working in web application. and here is my code,
$.get('xml/CourtReporter.xml', function (data) {
$(data).find("option").each(function () {
	ans_array.push($(this).text());
});
});
 
2:00 PM
var Promise = require('bluebird');
var pg = Promise.promisifyAll(require('pg'));

module.exports.foo = function() {
    return pg.connectAsync(connString).bind({}).then(function(client, done) {
        this.done = done;
        return client.queryAsync(qs);
    }).then(function(res) {
        this.done();
        return res;
    });
};
 
and my xml is
<options>
<option>Tells the newspapers everything that is said</option>
<option ans="true">Creates a word-for-word record of everything said in court</option>
<option>Tells the District Attorney everytime he stutters</option>
<option>Order Pizza for the Judge</option>
</options>
 
@rlemon ^*2
wait, that's wrong
that's better
when you call it like: foo().then(function(res) {}); <- res will be the one you return over there
var Promise = require('bluebird');
var pg = Promise.promisifyAll(require('pg'));

module.exports.foo = function() {
    return pg.connectAsync(connString).bind({}).then(function(client, done) {
        this.done = done;
        return client.queryAsync(qs);
    }).then(function(res) {
        this.done();
        return res;
    }).finally(function() {
        pg.end();
    });
};
taking care of pg.end() too ^
 
@DavidGarcíaGonzález 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.
 
@FlorianMargaine ohh man this is going to take a week or so to get my head around
I can already tell
 
it's easier to think of promises than callback I think :/
 
2:06 PM
probably. but I need to read the docs on it all first
I was reading the bluebird readme file.
it isn't as helpful as I had hoped. is there recommended readings?
 
noice
 
@YourMom 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.
 
Mom?
 
@ShankerPaudel 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.
@SimonLindgren 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.
 
2:19 PM
@FlorianMargaine why return foo() ??
app.get('/foo', function(req, res) {
  return foo() ...... ???
});
or just foo().then()...
 
you know what day it isss
 
Yesterday was Thursday (Thursday), Today is Friday (Friday)
We we we we so excited. we excited!
 
@rlemon yeah that's enough
 
no matter how many times I listen to this song I find new even more retarded lyrics
ohh god what a horrible song
its so bad I have to listen to the entire thing every time
@FlorianMargaine hehe wanna help me make bar return a promise now?
 
2:40 PM
sure
 
I have many node instances listening on different ports. before I proxy to one I check if it is listening.
 
ah
using event emitters is not so straightforward
fortunately...
 
schweet
easier than I expected it to be (given the query example)
 
that's the ugly way to use promises
since you have to use the resolve method
and not having any of the promises advantage
 
okay so i've attempted to implement things as you have guided me. the page is hanging. so I assume the .then is not being hit.
app.get('/foo', function(req, res) {
	db.getSubscribers().then(function(fres) {
		return Promise.cast(fres).map(function(item) {
			return portCheck.checkOpen(item.username).then(function(state) {
				return { username: item.username, state: state };
			});
		}).then(function(arr) {
			res.render('foo.ejs', { subscribers: arr });
		})
	});
});
 
2:50 PM
I was stupid...
gimme a minute
 
@mainsocial 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.
 
wait. is that .then on the wrong expression? @FlorianMargaine ?
 
that should be this: pastebin.com/Te60S6LY
but it doesn't change how the code works though
put console.log everywhere to see where it goes and doesn't go
@BenjaminGruenbaum you around? I have to leave soon
 
I'm with a friend, anything urgent?
 
Possibly unhandled TypeError: Object [object Object],function (err) {
          if(err) {
            pool.destroy(client);
          } else {
            pool.release(client);
          }
        } has no method 'queryAsync'
 
2:55 PM
What would you like me to take a look at?
 
I'm finally trying to use promises
 
yay
did you turn on long stack traces? That's one of the first thing you should do for development
 
@rlemon show code where you're using queryAsync pls :P
aaaand on this note, I'm leaving
 
2:56 PM
module.exports.getSubscribers = function() {
	return pg.connectAsync(connString).bind({}).then(function(client, done) {
		this.done = done;
		return client.queryAsync('SELECT * FROM subscribers');
	}).then(function(res) {
		this.done();
		return res;
	}).finally(function() {
		pg.end();
	});
};
 
Are you sure it's this line?
client is undefined I guess? are you sure connectAsync works properly?
 
I'll toss a log in there
 
what's the easiest way to paginate static data?
 
What's this.done for?
 
I'm flying blind. Florian pretty well wrote all of that from my non-promise code
 
3:00 PM
anyone having problems with youtube?
 
huzzah fellas :) I'm getting a weird ass error, jsbin.com/juviwale/1 this is telling me the request gets canceled
 
Anybody here have experience with `grunt-contrib-connect` and trying to serve up two separate projects at the same time?

I'm trying to leave one project up so that someone can take a look at it, but I have to work on the second. When I try to `grunt serve` the second one, I get the error that `Fatal error: Port 35729 is already in use by another process.`

I changed the port in my Gruntfile.js to a different port though under the `connect` task
 
what am not doing properly? (it's a simple get to a txt file)
 
@BenjaminGruenbaum i did skin detection with machine learning :-> and self wrote it :D
 
3:06 PM
@BenjaminGruenbaum client is defined, but it isn't what I expected to see (tbh I don't know what I expected to see, but it looks strange)
 
@rlemon just thought about it, client is not promisified
On mobile right now
 
user1596138
Holy shit does using Eclipse for PHP make it soooo much worse
 
Promise.promisify(client).queryAsync ??
 
!!tell Zirak define ultracrepidarian
 
@Zirak ultracrepidarian One who gives opinions on something beyond his or her knowledge.
 
3:07 PM
@FlorianMargaine ^^
 
@rlemon sounds good
@Benjamin pg requires done to be called when the request is done
 
@MoshMage When you do your $.get() it gets canceled?
 
yes
 
return Promise.promisifyAll(client).queryAsync('SELECT * FROM subscribers');
same error
 
@MoshMage I don't think we can help you debug with just that code sample. Open your debugger in the network tab and see the location it's trying to fetch
Double check that it's the right URL
 
3:10 PM
@rlemon weird
 
@Martin as soon as it get() it gets cancelled, I'm seeing it on chrome and.. that's all the code there is -- I can hook you with the html but it's a simple form
 
You should probably promisify the prototype @rlemon
 
Why?
Just wondering why that doesn't work as is
 
@MoshMage the location is correct though? Like "./template.txt" might not be the directory you're looking for. Do you have a page I can look at
 
yes, it's the correct location; 2s
provisioning.contentignition.com/_sandbox/jgoncalves/rcp <- this is the url while template.txt is in the same folder and domain
 
3:15 PM
I feel like absolute death today.
 
@BenjaminGruenbaum turned on long stack traces
Possibly unhandled TypeError: Object [object Object],function (err) {
    at Object.<anonymous> (/modules/db.js:9:39)
From previous event:
    at connectAsync (eval at makeNodePromisifiedEval (/node_modules/bluebird/js/main/promisify.js:198:12), <anonymous>:2:125)
so connectAsync is the issue?
 
posted on May 02, 2014

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {}

 
ooo
 
@Martin sorry, forgot to ident you, provisioning.contentignition.com/_sandbox/jgoncalves/rcp is the link and the file is in the same path and domain
 
3:19 PM
@MoshMage ok I'll take a look
 
@rlemon nice! I was thinking this should exist
 
haven't tried it yet
 
@Martin thank you so much - 'cos it's driving me crazy. Can it because the get is hooked on a on click event? (i never got that, but hey..)
 
@MoshMage when I do $.get('./template.txt') from the console it works
 
Because pg is a pain with promises by default
 
3:20 PM
@Martin exactly why I find it weird :|
 
@MoshMage definitely weird
@MoshMage I'm seeing something weird. Chrome is saying that there are "provisional headers shown" only when I click the button.
 
i think I'm going to need a complete +path, but tthat's just nuts
 
@FlorianMargaine trying to use it I get 'cannot find module pgpass'
:P
 
@rlemon bad path?
 
@RUJordan are you using postgres?
 
3:33 PM
No but if the module can't be found it might be a bad path?
 
@MoshMage no way
You won't need an absolute path
 
yeah, didnt work with absolute either. I'm aghast.
 
I love you guys
 
Love you too @Crow
 
Love me more ;)
 
3:36 PM
BTW while I'm here can someone help me out with my CR question? :)
http://codereview.stackexchange.com/questions/48708/factories-and-constructors-in-angular
 
// BlueBird Promise / node-postgres Question.
^ if anyone is free and interested :P
 
@user3388636 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.
 
@Martin it was so simple i feel like slapping myself:
I was chaning the url bar BEFORE the get got complete
 
@MoshMage HAHA wow
Where's my dunce cap..
 
3:54 PM
yeah, everybody here felt like giving me one aswell xD
 
Well at least it's resolved
 
0
A: Set Cookie if URL parameter exists

user3562415I think you didn't include the jquery cookie plugin. https://github.com/carhartl/jquery-cookie

I just died a little on the inside.
 
Hahahahaha
Well, in context, that makes sense
But pluck it out, and it's something we'd probably say around here
 
@vicgonzalez25 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.
 
That is true
I've been upgraded today!
I get to use Java guyz
First time since my freshman year at college.
 

« first day (1294 days earlier)      last day (3671 days later) »