« first day (1172 days earlier)      last day (3778 days later) » 

12:04 AM
posted on December 31, 2013

In the constant flurry of JavaScript MVC and MVVM drama I missed the release of React earlier this year, or rather I ignored the release, most probably dismissing it as yet another spin on expressive two-way binding. After reading "The Future of JavaScript MVC frameworks" I…

 
12:17 AM
Fuck Webforms
My beautiful markup, ruined!
 
haha
i'll never understand why that crap was developed in the first place
same for JSF etc.
 
	if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
		pcikbd_mrcoffee = 1;	/* Brain damage detected */
		goto found;
	}
 
@ThiefMaster no ajax. It was developed at the same time, as a competing technology.
@ThiefMaster the process in Microsoft was "give several teams the same issue without letting them know, have them compete and may the best solution win".
 
That doesn't sound like a particularly healthy approach
 
12:34 AM
indeed.
 
Ben beats me
it hurts
 
@Shmiddty I'm sure you deserved it
 
@Shmiddty ?
 
just razzin
 
12:37 AM
gotta run
ttfn
 
!!afk sleep
 
@BenjaminGruenbaum Apricots are people too!
 
no they're not
 
12:52 AM
Who loves scroll bars?!? :D
 
user1125394
1:07 AM
@CapricaSix the residents of Aprica?
 
1:30 AM
I am using jQuery to do some div animations on my page, but my links stop working when I use it. Why is that?
 
Because your code is sending the wrong instructions to the browser.
Possibly because it was written by someone who doesn't know what's going on.
 
user1125394
!!s/ animat/is/
 
@ctrl I am using jQuery to do some divisions on my page, but my links stop working when I use it. Why is that? (source)
 
@ctrl Nice
 
var cur = 1;
    var max = $(".container").length;

    $("#right").click(function(){

        if (cur+1 > max) return;
        cur++;

        $(".vertical-wrapper").animate({
            marginLeft: "-=20%",
        }, 1000);
        return;

    });

    $("#left").click(function(){
        if (cur-1 < 1) return;
        cur--;
        $(".vertical-wrapper").animate({
            marginLeft: "+=20%",
        }, 1000);
        return;
    });
That's my code.
Now, why is this preventing my links from working?
BAsically that's a slider code in jQuery.
 
user1125394
1:41 AM
not sure if return; must be there
 
You're returning undefined (a falsy value) which prevents default in jQuery
 
Ok, but I need the return in order to prevent further sliding.
If I don't return or return false, it will still keep sliding beyond the last element.
If I put a boolean false after the condition instead of the return, the links work, but the slider keeps sliding beyond the last element.
 
user1125394
$("#left").click(function(){
    if (cur-1 >= 1) {
        cur--;
         ...
    }
});
 
@ctrl Even if I do that, it doesn't work.
Btw, even when I return true and go a few clicks beyond the last element the links stop working.
But before I go beyond the last element they actually still work.
 
user1125394
1:59 AM
are you doing sth like a carousel?
 
Kind of, yeah, but with divs stretched across the entire viewport.
 
user1125394
 
2:20 AM
@BenjaminGruenbaum Had to switch computers, can you invite me back into that room for the test?
 
@monners BenjaminGruenbaum is afk: sleep
 
shit
 
 
3 hours later…
5:06 AM
ooohhh killum
 
5:25 AM
@EnglishMaster What?
 
Nevermind
I was just rambling
 
Joe
5:38 AM
how can i extend a class in javascript using the `function CLASS_NAME(){...}` syntax... say i had the following Character class

function Character ( x, y ) {
this.oX = x || 0;
this.oY = y || 0;
this.movementSpeed = 3;
this.width = 16;
this.height = 16;
this.color = "rgb(0,220,255)";
}

and wanted to make a player class based off of it with additional properties (say a user input controller) and modified methods? im guessing (but failing) that i need to assign the character proto to the player proto - but my ignorance of `this = new Character(x,y)` is not quite making it
or better yet what is this called so i can google it for better results
 
What?
 
@Joe you can call the superclass constructor from the subclass constructor
 
I think it's called plucking "Object Oriented programming"
 
as for prototypes, Glyph.prototype = Object.create(Character.prototype)
 
Joe
so if i define char class eg function Character(){ /* some props */} then later assign methods with proto.. ill still get those methods in the child class?
 
5:44 AM
@JanDvorak Object.create()? Why wouldn't Glyph.prototype = Character.prototype; work?
Oh, and hi. :)
 
@JanDvorak I forgot too, hi.
 
@RUJordan then the methods of Glyph.prototype would propagate to Character.prototype
 
Joe
@JanDvorak @EnglishMaster @RUJordan and btw ty guys
 
!!define propagate
 
5:45 AM
@RUJordan My pocket dictionary just isn't good enough for you.
 
Joe
@JanDvorak - but i do want the methods, as long as i can override them
 
@RUJordan propagate (transitive) To cause to continue or multiply by generation, or successive production; -- applied to animals and plants; as, to propagate a breed of horses or sheep; to propagate a species of fruit tree.
 
Joe
SOME of them
 
@rlemon fyi, the PhantomJS guys are moving forward with PhantomJS 2.0; it's using Qt 5.2 and is considered an early beta right now; I got a compiled binary for 64-bit Debian/Ubuntu from their issue tracker (hee hee hee, didn't even have to compile it!!) and it's working headlessly with my driver... THE DREAM... it is coming!
 
So it wouldn't be an inheritance it would be modifying the Character class directly?
 
5:47 AM
@Joe the Object.create ensures that Glyph.prototype gets the methods of Character.prototype but not vice versa.
 
Joe
well i would need to keep the original character methods intact as well
let me try this
 
the new webkit is running a much fresher JSCore that seems to implement ES5; I'm getting coffeescript errors but everything else including !!eval works, no shims needed
 
How come when I click a tag I prefer, only a select few of the questions are highlighted, and not all of them?
 
Joe
@JanDvorak ok thats passing all the methods properly - but im now stumped at calling the Character constructor within the player constructor to assign the props
 
@Joe Character.call(this)
 
Joe
5:55 AM
oooo interesting - i clearly have more reading to do. and thanks
 
What is a good JS book for more advanced learning? Like, anonymous functions are common practice for me now but prototype and more advanced object practices are still kind of iffy.
(Just a skill level measurement lol)
 
Joe
crockford has a good one "javascript the good parts"
 
anonymous function isn't really JS specific, it's more of a functional programming stuff
If you are interested in these, you should learn more about functional programming
And apply them to JS
^_^
 
@EnglishMaster I've never used IIFEs outside of Javascript
 
Regardless, I'm learning these concepts in a JS environment
 
6:01 AM
Well, when I used OCaml, they had anonymous functions too
 
That doesn't mean I need to use OCaml to learn though, it seems like a pretty universal concept to me
 
I think best way to learn FP is not to take a course at a college. It will mass up ur GPA and emotionally put you down
You should just learn it online
 
Besides, I also mentioned that I'm past anonymous so this is a bit irrelevant
Uh, I graduated college last summer
 
start with Crockford
 
great
 
6:03 AM
@JanDvorak it's pretty thorough with good explanations?
@EnglishMaster my GPA was a 2.5 I was pretty happy with that though lol
 
@RUJordan I've seen the last of his presentations; he's good at it
 
Joe
hes a sharp guy, js OG for sure
 
It was those stupid gen ed classes. I'd bomb history because I was working on my programs all the time
 
Joe
lots of good talks on youtube also if you want a taste
 
Awesome, thanks for the recommendation
 
6:05 AM
I think Crockford or JS Ninja books are pretty useless. Nobody needs to know DOM level 12345 to work on your project
 
level 12345?
Huh?
 
1/2/3/4/5
 
They talk about all these things like DOM level 1, 2, 3, 4 ,5 ,6 ,7 ,8, 9
 
uhh. not an important thing to know...
 
clearly i only know the important javascripts
:P
 
Joe
6:11 AM
@JanDvorak so every time i 'extend' in this manner, i am expected have to reassign the parent class's methods to the child's? jsfiddle.net/R6CW5/4 here im failing trying to assign this.prototype and im creating a property with its own methods... fml
dont want to keep bugging let me find an article
 
How do I view edit histories?
 
Joe
sorry updated the link
 
@Joe prototype is a property of the constructor that specifies the constructed object's [[proto]]
@Joe Player.prototype = Object.create(Character.prototype);, and move it outside the constructor.
 
Good evening
 
@EnglishMaster Are you drunk?
 
6:15 AM
the .prototype of the constructed objects is not interesting (unless you're making classes)
 
Joe
@JanDvorak oh nice! - i didnt think i could run assign Player.prototype before the function declaration
but that works perfectly ty again
 
you should place it after the declaration, however
I think it's better style
 
Joe
interesting - all i need to do now is consider if having player object of class type 'Character' will ever become an issue
 
@Joe do you need the classes after all? 90% of the time, anonymous classes will do just fine
 
Joe
actually not at all , this is just a learning exercise
 
6:19 AM
{x:10, y:1} //Point2D
 
Joe
done some oop in C in the past just wrapping my head around some stuff in js
 
my advice: if you ever do instaceof in a dynamically typed language, you're doing it wrong (or you're facing a badly designed API) ;-)
 
Joe
the obligatory canvas game engine right of passage, if you will
@JanDvorak good to know lol
 
remember that Javascript supports mixins (sort of):
for(func in MyMixin) this[func] = MyMixin[func]
or, if you want to mix into a class,
 
Joe
ooo - so i can blend a bunch of them
very sweet
 
6:24 AM
for(func in MyMixin) MyClass.prototype[func] = MyMixin[func]
 
Joe
yea i will definately give that a try - i was pretty happy finding requirejs... not sure of the performance implications im taking on by using it. however it lets me "emulate" a C-like project filesystem
without having to manage my own depenencies via html
thank jesus
allright well thanks all for the tips and the chat - but ive overshot a decent nights sleep by enough already
have a good night people
 
7:02 AM
@BenjaminGruenbaum , @Loktar ^
 
@AbhishekHingnikar BenjaminGruenbaum is afk: sleep
 
vs7
hi ,
i need help , i'm looking for same library


http://www.jcrew.com/browse/popup_single_product_detail.jsp?jproduct=09616&imgSrc=http://s7.jcrew.com/is/image/jcrew/09616_GR1705_m?$pdp_fs418$&isFeatureColor=true
where picture can zoom on same place
 
8:11 AM
I'm having trouble understanding how 150 / (1.3 -> 3.3) should return something between 15 and 42. 150/3.3 = 45.45 rep -- so the minimum range here is 45.45 -> 115.38 — RUJordan 1 min ago
Is my math wrong or am I right here?
 
8:22 AM
3
Q: Why if(key in null); throw exception while for(key in null); does not, it is the language design flaws on it?

justjavacFrom a language design perspective, why: if('k' in null); TypeError: Cannot use 'in' operator to search for 'k' in null BUT: for('k' in null); print undefined in ECMAScript spec: 11.8.7 The in operator 12.6.4 The for-in Statement It is the language design flaws on it?

 
user1125394
!!> '' in {}
 
@ctrl "TypeError: invalid 'in' operand null"
@ctrl false
@ctrl false
 
This is an interesting question, because
!!> typeof null
 
@RUJordan "object"
 
!!> typeof 1
 
8:30 AM
@EnglishMaster "SyntaxError: missing ( before formal parameters"
@EnglishMaster "SyntaxError: syntax error"
@EnglishMaster "number"
 
!!> ((1<<31) + (1<<31)) >>> 0
 
@EnglishMaster -4294967296
@EnglishMaster -2147483648
@EnglishMaster 0
 
!!> ((1<<31) + (1<<31)) >>> 0
 
@EnglishMaster 0
 
!!> (1<<31) >>> 0
 
8:33 AM
@EnglishMaster 2147483648
 
!!> ((1<<31) >>> 0) + ((1<<31) >>> 0)
 
@EnglishMaster 4294967296
 
!!> ((1<<32) >>> 0)
 
@EnglishMaster 1
 
!!> (1<<52)
 
8:39 AM
@EnglishMaster 1048576
 
You should probably take that to the sandbox
 
8:50 AM
Wait, that's not what I was trying to do
I was trying to make up a 64 bit long-value in JS
 
Hello, I'm writing my first jquery exercises and have this button that's supposed to show some elements and hide others:
$(".usermode").hide();
$(".expertmode").show();
however, this only hides one div with the given class instead of all.. Should I iterate over them or what?
 
this should work, fiddle please
 
Is 53 bit the maximum value for Number in JS?
 
@EnglishMaster not maximum, maximum odd
 
Ok nvm
 
8:57 AM
then you lose integer precision
!!> var x = 1; while(x !== x+1) x*=2; Math.log(x)/Math.log(2)
 
@JanDvorak "ReferenceError: x is not defined"
@JanDvorak "SyntaxError: syntax error"
@JanDvorak 9007199254740992
@JanDvorak 53
 
9:15 AM
Hey guys, I was experimenting with Carousel for bootstrap, and was wondering what exactly does this mean
`<img data-src="holder.js/900x500/auto/#555:#5a5a5a/text:Third slide" alt="Third slide">`
How do they link an image to a javascript file?
 
Hello, I have a button onclick handler that's supposed to show some divs with a specific class and hide some with another class. However, it only shows/hides one div. Any idea where the problem might be?
 
user1125394
!!tell krika mdn data attribute
 
9:31 AM
@JanDvorak my function is working in JsFiddle but not with my own document! Any idea why?
 
@PLaine forgot to wait for document ready?
 
@JanDvorak No it was because I was refreshing the wrong version of the page! :(
working now just fine....
 
10:18 AM
new hat
hehehe
another secret hat...
 
10:32 AM
huh... I've never seen that. Rep-cap 20 times?
 
:D
earned necromancer badge
 
11:20 AM
@hunterc no, check if a Date method exists instead. As you said, frame issues. And duck typing.
 
nvm
Guys, as a westerner, if your server at Mcdonald purposefully poured in normal Coke instead of Diet coke as you ordered. Do you think you can notice it and make a complain?
 
I can definitely taste the difference between coke and diet coke. I would ask for what I ordered.
 
11:54 AM
Is it treated as abnormal when you are walking around streets while drinking Capri-Sun?
 
Wait, our bot has a japanese boyfriend?
 
12:20 PM
what?
 
Capri-sun is not Caprica's boyfriend?
 
It's a drink mate
Container looks like a plastic bag
Is it considered as abnormal when you walk around streets while drinking Capri-Sun?
 
not neccessarily
 
user1125394
1:01 PM
if age < 16
 
I not guess!!!
 
Hi !
 var tb = document.createElement('textarea');
  tb.style.border = '0';
  tb.style.font-family = 'arial';
why does the last line doesn't work ?
 
look at it closely
and then consider what else - is used for :)
 
sorry?
i don't see :)
 
1:40 PM
!!> 100-33
 
@ThiefMaster 67
 
ohh @ThiefMaster - stands for a subtraction here ?
 
maybe that helps you find the mistake
exactly, - is always the minus operator
 
ok!!
 
you want fontFamily
 
1:40 PM
ok!
 
dash-separated names always convert to lowerCamelCase
 
I learnt something, thanks !
May I ask another question ? (Sorry I know I shouldn't ask to ask ...)
How to make that the textarea is automatically resized on keystrokes?
ie it is initially just 10px x 10px square, and then if I write some text, it is automatically resized
 
that's not a good interface IMO
 
(I really need that, that's not for a classic web page)
 
count how much space the content takes and resize if it doesn't fit?
 
1:45 PM
vertically resizing it is not too bad.. but horizontally? ugh, please no
 
I need both, really.
 
you don't
 
That's not for a traditionnal web page
that's for some sort of online Paint tool
 
but, text areas are not transparent
 
1:46 PM
with Text on a canvas
 
forget textarea, just listen to keystrokes.
 
@JanDvorak : is it possible to make them transparent background ?
 
@Basj I'm not aware of that
 
I thought it could be possible with traditionnal css
do you think it won't work ?
it works with a classical background-color: transparent;
@ThiefMaster do you think it is possible to override CTRL+PLUS or CTRL+MINUS in order to launch something in JS ? (they are traditionanly used by the browser for zooming)
 
give it a try
since you can even prevent ctrl+t, f5, etc. from triggering the default behaviour i don't see why it shouldn't work for those keys
 
1:57 PM
Would you use :
$(document).keydown(function(e){
if (e.keyCode == 37) {
alert( "left pressed" );
return false;
}
});
and find a keycode for CTRL+PLUS ?
 
@OctavianDamiean you around?
wow, he hasn't been on since Dec 20... dammit
 
@ThiefMaster : do you have an example for overriding CTRL+T ?
 
console.log is for dummies, real developers use breakpoints !
 
no, but i noticed it not working on some sites
jsbin for example
 
@AbhishekHingnikar breakpoints are for dummies, real developers watch the variables evolve in real time
 
2:03 PM
hm, that would be interesting @ThiefMaster
 
@JanDvorak Variables are for kids, real developers use memory references which name themselves and evolve in real time
 
no time to test right now, but we should update this answer then
it's a little outdated now
 
@AbhishekHingnikar this is not possible in javascript, however
 
@JanDvorak real developers never use javascript.
 
in javascript, real developers watch the wireshark log, then reproduce the traces manually
 
2:04 PM
they use butterflies
 
posted on December 31, 2013

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) {} Happy new year, geeks!

 
Do some of you use Node ?
 
57 secs ago, by Abhishek Hingnikar
@JanDvorak real developers never use javascript.
 
Sorry I'm too newbie in languages to understand such kind of jokes ;)
about the solution here : stackoverflow.com/questions/7295508/…
(the one with 30 upvotes) : can I just copy/paste this in my <script> </script> or do I need to replace $window by something
 
as long as you have jQuery included, it should work
 
2:10 PM
ow okay!
I haven't
 
Hey @BenjaminGruenbaum How did your tests go? :-)
 
@Basj "can I just copy/paste this" never has a valid positive answer
 
@Basj well then try window.onkeydown = function() { ... }
 
thanks!
@JanDvorak can I do class in JS that herits from textarea ie I will create a class like textarea but that has more child variables...
I don't know to explain better
 
@Basj I doubt you can use the existing prototype to your benefit
 
2:20 PM
which existing prototpye ?
 
Hi guys :) I need just simple information :) I use Jquery,and I would like to learn more deeper,so do I have reasons to learn first Js or it is ok to start momentarily Jq. Tnx,Pavle
 
@JanDvorak in order to learn about that, what keyword should I search on SO ?
Is it "subclass" a textarea ? "object heritage" ?
 
@Basj rather avoid your idea completely
 
I used this in Python in order to do what I want, and it worked perfectly.
(for Textboxes widgets...) so I thought there was smthg similar to "subclass" in JS @JanDvorak
 
@Basj hint; new HTMLTextAreaElement() fails horribly
 
2:28 PM
ok...
I have to go now. Thanks for all the tips, it has helped me a lot (now CTRL+PLUS works!)
Bye bye and good new years eve
 
SO in read only mode?
 
heh, indeed
 
LOL
> XOXO,
The Stack Exchange Team
 
@qwertynl Big kiss, big hug, big kiss, big hug.
 
@canon It seems.
 
2:35 PM
Did you hear about the lion that became a cannibal? It had to swallow its pride.
5
 
@rlemon ha
 
2:58 PM
@qwertynl good, and thanks for helping.
 
@BenjaminGruenbaum You taste just like raisin.
 
@BenjaminGruenbaum No problem. It was fun :-) Let me know if you ever have anything else :-D
 
Cool, you did good. Pretty much everyone here did a lot better than the majority of people we interview.
 
Where is this job located? :-P
 
You were the fastest and I think @ThiefMaster was the cleanest. The other solutions were also very decent.
 
3:00 PM
@BenjaminGruenbaum Haha I was doing it while working using the simplest things I could think of :-P
 
Hi guys :) I need just simple information,sorry for repeating :) I use Jquery,and I would like to learn more deeper,so do I have reasons to learn first Js or it is ok to start momentarily Jq. Tnx,Pavle
 
start w/ JS
 
@Pavlen jQuery is just a JS library
 
Thanks!
@Benjamin, I know,but I use so much Jquery,I start immediately with Tutorials search :)
 
3:05 PM
Ummmm
 
Is there a way to find out interesting unanswered questions and filter out all those homework / boring / noob questions?
 
user1596138
Has anyone ever used, seen or even heard of Leap Motion?
 
user1596138
Seems utterly useless. But I want it.
 
Yeah I've seen a video of it
 
user1596138
Nice..
 
3:10 PM
My first use-case of it I had in my mind when I first saw it was to incoorporate it with 3D Hextai
 
user1596138
 
user1596138
I don't like that last one. What the hell.
 
Normally everyone has Internet connection nowadays unless you are from Pyongyang or ZhinZhin (some random Chinese village name)
 
user1596138
And the company talks about how complicated our hands are, going as far as mentioning the amount of nerves/arteries in 1 hand. As if those matter.
 
user1596138
@EnglishMaster Right. But I shouldn't need it to use the thing.
 
3:14 PM
If you said "Right. But I shouldn't need it to use the thing." in real life, would you do an airqoute when you are about to say the word "need"?
 
user1596138
I have internet everywhere I go. It's been years since I couldn't just pull out a phone/tablet/laptop and be connected. But it shouldn't be a necessity, and exactly what info could it possibly need from somewhere else to recognize my hand gestures..
 
user1596138
@EnglishMaster No, I would drag out the "long e" sound in the middle of the word for emphasis.
 
@EnglishMaster wifi balloons, imo
 
user1596138
Single quotes (around here) usually imply sarcasm or mocking of some kind. Or using a word and stretching it's meaning to something it doesn't actually mean on purpose.
 
user1596138
3:17 PM
But you are the English Master.
 
user1596138
@Canon lets start an initiative to bring wifi balloons to unconnected areas. You do all the planning, funding and actual execution of the plan. I'll watch and take credit?
 
Yeah, I am the EM. However, I can see you "Rack Disciprine!"
 
user1596138
You've used China twice in 4 messages for unrelated jokes..
 
user1596138
> Reach into the universe, grab the stars, and soar around the sun. It’s a whole new way to learn.
 
user1596138
Umm... It's a hand gesture sensor. Please.
 
user1596138
3:20 PM
They make it sound like LSD or something.
 
Also, ow... stars are really hot.
 
user1596138
> In just one hand, you have 29 bones, 29 joints, 123 ligaments, 48 nerves, and 30 arteries.
 
Hey family Happy New Year :D
 
"Reach into the 3D girl, grab her xxx, and soar around her naked xxx. It's a whole new way to xxxx"
 
@EnglishMaster sad.
 
user1596138
3:22 PM
Wrong! I have 30 bones in my right hand.
 
@Jhawins what's the 30th one?
 
user1596138
!!s/xxx/thighs/g
 
@Jhawins "Reach into the 3D girl, grab her thighs, and soar around her naked thighs. It's a whole new way to thighsx" (source)
 
Are you perhaps an emo?
 
user1596138
@JanDvorak Idk? They said I had an extra. Lots of people have a few more or less.
 
user1596138
3:24 PM
I broke/bent/twisted my middle finger/metacarpal when I was younger and had a bit of work done..
 
@Jhawins I'll just get funding from the NSA. spy balloons...
 
user1596138
@canon I'm in.
 
user1596138
Oh it comes with "2 custom-length USB 2.0 cables"! So luxury. Much nice.
 
user1596138
@rlemon Overlay with blocks half the size on the webcam. Would be interesting.
 
user1596138
3:28 PM
Tons of tiny spikes following your every move
 
webcam stuff + canvas is really easy. you should just give it a shot
 
can you please help me with this one: stackoverflow.com/questions/20833368/complex-algorithm
 
user1596138
@rlemon I'm setting up a DB for work right now :/
 
user1596138
I've never used canvas for anything that didn't absolutely suck either. It'd be easier to get into if I had even 1 reason to use it for real haha.
 
3:32 PM
For all users Happy new year!
 
user1596138
@AbhishekHingnikar It's already the new year over there?
 
user1596138
It's December 31...
 
user1596138
@rlemon Fine..
 
it is really very simple
thinking of cool shit to do.... not so much
 
user1596138
^ Yeah that's the problem
 
3:43 PM
@Jhawins It isn't
He's wishing you guys preemptively
I may have misused "preemptively" there, but who's going to correct me?
 
3:58 PM
yay! got a secret hat, and I think I know why
 
which one?
 

« first day (1172 days earlier)      last day (3778 days later) »