« first day (1374 days earlier)      last day (3588 days later) » 

12:47 AM
@Crow Only if you don't intend to tweak it much
 
 
1 hour later…
1:58 AM
!!s/ea/er/
 
lol
 
2:24 AM
hi
document.form.diabled = true -> is it works?
i am using iE11 but thi code is not working now
 
bah. Anyone pretty good at underscore? I have something working but feel like there MUST be a better way to do it
 
@Crow: just ask, if someone's around they can help. I'm not too bad at underscore myself, but not "ninja-level".
 
2:45 AM
i need help
 
2:59 AM
@Crow I've used it quite a bit
 
hmm, shouldn't arr.slice(0) give me a fresh copy of arr?
 
@Mosho assuming that obj is an array?
 
here it is; my javascript is TERRIBLE: gist.github.com/DarkCrowz/c38f95add8cf6e55d2a5
 
0
Q: Why is this nested promise.then executed before the promise's method?

OmnipotenceI am trying to use promises to call getLoginState and then store that value so I can use it later. I am wondering why in the following codeblock, the .then inside of q.fcall(getLoginState) is called before the getLoginState method? var mysql = require('mysql'); var q = require('q'); var login...

 
@phenomnomnominal already edited :X
 
3:00 AM
@Mosho sorry, too slow
 
twss
@Crow can you explain in words? too tired to look at someone else's code
 
@Crow my brain can't even process that right now.
^^ that
 
basically, it's just making a dictionary of all the values in the form and sending them to the backend, then the backend sends back all the errors as json
 
@phenomnomnominal seems like it gives you a real copy only for primitives
 
@Mosho I presume it just gives you a copied set of references?
 
3:04 AM
yeah
I guess it makes sense :X
 
Lame
Hope they add a deep clone to the spec
 
!!> arr = [{1:1},{2:2}]; arrCopy = arr.slice(0); arrCopy[0][1] = 42; console.log(arr);
 
3:20 AM
@Crow
    dict2 = {};
    s.each(function(){
      var el = $(this);
      dict2[el.attr('id')] = el.val();
    });
    dict2 = {};
    s.each(function(i,el){
      dict2[el.getAttribute('id')] = el.value;
    });
etc.
no need to get too fancy :P
    dict2 = {};
    for (var i = 0; i < s.length; i++) {
      dict2[s[i].getAttribute('id')] = s[i].value;
    }
^minimum fanciness
    dict2 = (function(s){
      var obj = {};
      for (var i = 0; i < s.length; i++) {
        obj[s[i].getAttribute('id')] = s[i].value;
      }
      return obj;
    })(s)
^because why the fuck not
 
hi 17
 
3:48 AM
hi
 
4:09 AM
 
4:20 AM
^ ha
 
4:45 AM
Guys I need help -- I tried to start my server to do some work, and when I went to my site all I saw was the index directory -- which exposed my server code and db credentials. I shutdown my server and changed the passwords etc, but I don't know why it's exposing the directory. It's like NodeJS isn't running despite me using nodemon and npm forever. Any tips would be great else I risk being hacked D: PING ME IF YOU KNOW WHATS WRONG!
 
@SterlingArcher try that
Also check to see what services start with the machine
 
i will when I wake up :) it's late and i need to sleep for work
night!
 
@SterlingArcher Looks like apache took over
If you want a failsafe, just have an empty index.html or the likes
A better failsafe would be to disable the dir listing configuration
 
5:05 AM
a best failsafe would be to uninstall Apache
@Aamir this.... probably isn't the best place to post that.
 
1 message moved to Trash
Come on...
 
6:04 AM
Here's something fun: iOS registers both touchstart/end AND mousedown/up, at the same time!!!
 
m59
@dystroy wow.
maybe he has a job interview tomorrow lol
 
And he thinks having 300 rep instead of 200 would get him a job ?
 
@dystroy Oh no! You found my reddit handle!
 
I hesitate to contact him and then download his answers instead of upvoting...
@ThiefMaster If you want to play, there's a redditor to PM ^
!!/s/download/downvote
 
6:18 AM
Let's see if he's stupid enough to reply to my PM sent from my main account... :D
 
Now I can stalk @monners on reddit : reddit.com/user/m0nn3rs
@ThiefMaster I hope you'll tell us :)
 
@dystroy Prepare to be underwhelmed
 
guys
in this ffiddle
front office and food beverage are sortable
but question inside food beverage and front office are not
can any body please tell me how to solve?
 
There might be a deficit in people interested in jQueryUI here. So, you might want to ask main SO instead.
@Loktar Interesting but without a permanent way to select the language it's barely usable for anybody detected as speaking French.
 
ok
thanks
 
6:36 AM
I miss the good old days when only people who already knew a lot about programming where asking node.js questions...
The same with Go.
I shall leave those old things and go for something new :\
rust changes everyday. So... what new shiny language to learn today ?
 
Swift?
 
@monners go away, Apple-lover
 
@dystroy Haskell is always shiny and scares the shit out of people who want to do stuff for work rather than code for fun. Scala is also pretty decent although it's getting noobs too.
Erlang is always hipster-ish
All worth learning
 
@JanDvorak lol, I can assume you I have nothing but angst for Apple today
touch AND mouse events on iOS. Fuckers.
 
6:52 AM
@monners what do you mean? The default action of touch events is to trigger the respective mouse events.
 
@JanDvorak on an iOS device touchstart and touchend are triggered alongside mousedown and mouseup. they're distinct events
Both triggered by touching
 
@monners even if you preventDefault on both?
 
@JanDvorak Tried that. No dice
 
eugh
I've never used mouse* events. click and drag* suffice for me.
 
@JanDvorak mouseover?
 
6:56 AM
Had to conditionally set my bind events on load specifically if iOS is the agent. I know device sniffing is all kinds of awful, but fuck
 
Oh, we're talking about iOS?
 
@SecondRikudo ok... maybe mouseenter/mouseleave
 
@SecondRikudo Ummm, no. These are drag events I'm working with
 
7:23 AM
Fellas when connecting to mysql I get the following error (dump of err parameter to the error handler:)
{ [OperationalError: connect EHOSTUNREACH]
  name: 'OperationalError',
  message: 'connect EHOSTUNREACH',
  cause:
   { [Error: connect EHOSTUNREACH]
     code: 'EHOSTUNREACH',
     errno: 'EHOSTUNREACH',
     syscall: 'connect',
     fatal: true },
  stack: 'Error: connect EHOSTUNREACH\n    at errnoException (net.js:904:11)\n    at Object.afterConnect [as oncomplete] (net.js:895:19)\n    --------------------\n    at Protocol._enqueue (/home/dor/node_modules/mysql/lib/protocol/Protocol.js:135:48)\n    at Protocol.handshake (/home/dor/node_modules/mysql/lib/protocol/Protocol.js:52:41)\n    a
Connection code is:
 
@SecondRikudo sounds like the database is unreachable
 
function getConnection(){
    var connection = mysql.createConnection({
      host     : 'host',
      user     : 'user',
      password : 'pass',
      port     : 3308
    });
    return connection.connectAsync().return(connection);
}

var publishers = getConnection()
    .then(function(db) {
        //return db.queryAsync('SELECT `name` from trc.publishers;')
        return db.queryAsync('SELECT 1+1 as solution');
    }).then(function(result) {
        db.end();
        return result;
}).error(function(e) {
@JanDvorak But it is, I can reach it just fine from WorkBench
 
'host' doesn't sound like the right domain name
 
@JanDvorak I obviously removed it, but the host name is confirmed (copy pasted from workbench, and copy-pasted back into workbench to make sure no whitespace problems)
 
try pinging it from the webserver
 
7:27 AM
Just tried. Seems like it is actually down, my bad.
Weird-ass workbench is saying that it's still up
ffs
 
@SecondRikudo try refreshing ;-)
 
@JanDvorak I clicked "test connection" and it says it passes
 
could be a connection problem, then
 
@JanDvorak No, the machine is down
Confirmed that with IT
shite workbench
 
7:45 AM
Just now, someone answered on a JavaScript question about concatenating $ and a number: "Write "\$" instead of "$". "$" is special character and you need to escape it with "\""
... wat
 
@Cerbrus link?
 
Yeah, I already found it :P
Thanks
 
how to assign multiline value to a variable?
 
@AvinashRaj You don't.
 
7:52 AM
@AvinashRaj you mean a string ?
 
Anything specific you need?
!!tell AvinashRaj google javascript multiline string
 
> var str="foo
... bar
... foo bar";
 
She's still dead.
 
it won't work for me
 
You can use string concatenation
one nice way is this:
 
7:54 AM
var s = "this\
  is a multi\
  line value";
console.log(s);
 
var mustr = [
  "this",
  "is a multi",
  line value"].join("\n")
 
You can directly use a multi-line string literal with ``
 
var str = "mul\nti\nline!"
Readable, eh?
 
> var str = "mul\nti\nline!";
 
7:56 AM
@dystroy: backticks? wut?
 
it works nice.
Thanks,
 
@Cerbrus what's the problem ?
 
@Jan's option is nice for larger strings, though. more readable.
 
@dystroy since when?
 
"You can directly use a multi-line string literal with ``" <-- Can you give an example?
 
7:58 AM
@JanDvorak Well... it was available in C, then in Java, then in JS. I don't know if it was available in C ancestors
 
Backticks have no syntactical meaning in JavaScript. They're not string delimiters
They're just another character
 
@Cerbrus uhh.... that's not true.
 
@BenjaminGruenbaum: Oh?
Show me :3 (please)
 
ungh, ok
You could have totally found that yourself by the way.
 
Hrm, ecmascript specification, talk about an "easy read"
 
8:05 AM
This isn't updated, but here - wiki.ecmascript.org/doku.php?id=harmony:quasis
 
If I understand that correctly, the backtick is used in regexes, right?
 
No, it's used in string interpolation
I wonder if Rick wrote about it somewhere
I think it's called "Templates"
Good enough?
 
Looking through the pages
I think I should revise my statement
"Backticks have no syntactical meaning in ecmascript implementations 5 or lower."
Something like that
 
Well, you were right until your last statement, you can use backticks everywhere inside string literals.
 
Yea, but as of E5, they don't have a special meaning in there, right?
 
8:15 AM
Of course they do.
Unless I understand incorrectly.. they've always been used in regular expression syntax
 
... Okay, now I'm confused.
Herp derp, regexes...
 
Also strings I'm fairly sure
This is one of those types of statements that seem so completely obvious that you're almost surely wrong for thinking the way that you do, so.. I'm probably wrong
Error: Obvious overflow.
 
regular-expressions.info/refcharacters.html doesn't even mention backticks.
 
Also strings I'm fairly sure
 
So, what meaning should a backtick have in a string, then?
 
8:23 AM
"Don't make the next character special"
In regex at least
 
So, it's an escape character?
 
And apparently a lot more than that too
 
that would be a backslash
 
Let me put it this way, if you put "n" in a regular expression and interpretted it to mean newline, how do you write actual literal "n" at that point?
what the hell is a backtick then?
 
`
^ a backtick.
 
8:25 AM
Oh, well that explains the obvious overflow
 
do we have any tools which converts css radial gradients to canvas gradient?
 
@BenjaminGruenbaum managed to do that MySQL connection thing :P
Although there's one thing I haven't managed to pull off cleanly.
var publishers = getConnection()
    .then(function(db) {
        conn = db;
        return db.queryAsync('SELECT `name` from trc.publishers')
    }).then(function(result) {
        return _.pluck(result[0], "name");
    }).error(function(e) {
       console.error(e);
    });

var promises = Promise.all(publishers.map(makeRequest)).then(function(results) {
    console.log("Success! Total of " + results.length);
    conn.end();
});
In order to close the connection at the end of the run, I had to break scope.
Can you think of a cleaner way to do this?
 
isn't there like a promise finally? (runs code regardless of success/failure)
 
@Neil: oooooh, now it all makes sense xD
 
@Neil Hmm, there should be actually...
 
8:30 AM
@Cerbrus Yeah sorry, me not seeing the big picture
 
@Neil yeah there is
 
@Cerbrus That I know of, there shouldn't be a problem with the backtick
 
@SecondRikudo Promise.using, for the third time :P
If you really don't like using, you can do something like this:
 
@BenjaminGruenbaum I'm already halfway through reading it, for the third time :D
var publishers = Promise.using(getConnection(), function(db) {
        return db.queryAsync('SELECT `name` from trc.publishers')
    }).then(function(result) {
Like this, right?
 
function withConnection(action){
    var conn = null;
    return getConnection().then(function(db){
         conn = db;
         return action(db);
    }).finally(function(){
        if(conn) return conn.end();
    });
}
This is like a dumb using that only works for one thing which is a connection
withConnection(function(db){
    return db.queryAsync('SELECT `name` from trc.publishers')
}).then(function(results){
    // connection is closed here
}) ;
 
8:34 AM
I currently have this:
var publishers = Promise.using(getConnection(), function(db) {
        return db.queryAsync('SELECT `name` from trc.publishers limit 100')
    }).then(function(result) {
        return _.pluck(result[0], "name");
    }).error(function(e) {
       console.error(e);
    });

var promises = Promise.all(publishers.map(makeRequest)).then(function(results) {
    console.log("Success! Total of " + results.length);
});
Connection is not closing
 
Do you have a .disposer in your getConnection?
 
Nope. Reading through the API for the fourth time :D
Yup, works nicely with the disposer.
 
Don't worry, it takes a little time to get (as do most concepts with promises) but once you do it's really cool.
 
I'm still having a bit of a hard time to follow the program execution with promises
But I'm already loving it, so yeah :D
 
8:48 AM
Phew another alarm
@BenjaminGruenbaum you in TA?
 
Hi
Can anyone suggest a jquery library to create a HTML5 canvas app like
 
@Shin jQuery is a library...
 
sorry,I mean jQuery plugin
:)
 
@SecondRikudo yeah, why?
 
@BenjaminGruenbaum Was wondering cuz alarms
 
8:59 AM
@Shin what?
@SecondRikudo ah, those don't really bother me very much to be honest.
 
@BenjaminGruenbaum Me neither. Rockets can't kill Madara.
:P
 

« first day (1374 days earlier)      last day (3588 days later) »