« first day (967 days earlier)      last day (3987 days later) » 

5:00 PM
it doesn't have to be slow to get in the way of your work
 
It's an i7 with 8GB, IIRC
 
@vzhen 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.
 
@SmartShovon Sure!
 
5:01 PM
I'm running my dev environment in VirtualBox, but all the resources for the dev image are set as high as are allowed
 
@BenjaminGruenbaum please tell me
 
@TomW Wow, that sucks
@SmartShovon ok
 
lol
 
@BenjaminGruenbaum sorry i don't understand...
 
Anyone can suggest me how can i store user login info for later use?
I'm using angularjs with firebase
What i'm thinking is, once user login, I store user auth info in $rootScope
Then whenever I want to use this auth info in other controllers. I just get it from $rootScope. Is this ok? or any suggestion?
 
5:02 PM
@SmartShovon glad I could help.
 
@BenjaminGruenbaum please tell me ... how i can do it?
 
@BenjaminGruenbaum very insightful answer
 
@vzhen If your app is relatively small that's ok.
@SmartShovon ok, I tell you how to do it.
 
@benja
 
@BenjaminGruenbaum ok
 
5:04 PM
@BenjaminGruenbaum normally, how people store the auth info ?
Cookie ?
 
@SmartShovon good.
 
@BenjaminGruenbaum i am going to award you with 10 internets
congratulations on your prize
 
@vzhen Usually, people use an HttOnly (not accessible from code) cookie containing a session ID, read on sessions. I'm not sure how it works in FireBase, I know they have some form of authentication built in.
@vzhen I'd read the OWASP page on it if I were you.
@redline I love help vamps ^_^
 
lol
 
@SmartShovon Ok, u got jquery?
@redline @TomW Neither of you happen to have any experience in developing Windows Phone 8 apps right?
 
5:07 PM
nope
 
i dabbled with them a little bit, but probably just as much as you have
 
@BenjaminGruenbaum i use marquee code like that <FONT SIZE="3" FACE="TT"><MARQUEE WIDTH=1400px HEIGHT=25 BEHAVIOR=SCROLL DIRECTION=RIGHT LOOP=3>anyletter</MARQUEE>
 
i love my lumia 920
omg i haven't seen a marquee in decades
 
@SmartShovon marquee is deprecated IIRC
also, it looks terrible
 
it was cutting edge back in the day dude
the most advanced HTML around
i can make text scroll on it's own
WOAH
 
5:09 PM
@JanDvorak can i do this marquee code... what i want
 
@SmartShovon Yes, u know jquery?
 
!!urban marquee
 
@JanDvorak Marquee The most annoying HTML code in the history of HTML codes.
 
@BenjaminGruenbaum now so much...
 
AHAHAHA
 
5:11 PM
@SmartShovon k, now u include jquery.js and jquery.min.js in ur page, must use both for it to work, k? then u use jquery
then MARQUEE work
@CapricaSix Probably blink
 
did you really just use "ur" and "u" for him...that's just contributing to the problem
 
@BenjaminGruenbaum can you give me that code...
 
@SmartShovon www.jquery.com
@SmartShovon everything you need is there
 
@SmartShovon In order to use jQuery, you must first unlock the jQuery within, are you willing to start that journey of self discovery?
@redline What problem?
 
the problem which rosetta stone would solve...i would certainly hope
 
5:15 PM
@redline There's no problem. If a user has only questions and not answers, does not explain himself well, and has nothing interesting to say I see no use in really helping them. These sort of help vampires only harm this room polluting it. No harm in having a little fun first though :P
 
@BenjaminGruenbaum if you don't don't mind .. i want to say... i don't know so much about jquery ...i don't know which code i use.....
 
@SmartShovon Do you believe that you can be one with jQuery one day? Do you have absolute faith in jQuery? Say Hallelujah!
(If you don't say Hallelujah I can't help you with your Marquee problem, I only help believers in the one true Resig god)
@redline If the first thing a user says when they come here is "give me code" there is no chance they'll ever get help. We like learning and teaching stuff, not doing freelance for free.
Yay, just noticed
I developed quite a bit in JS now and I was completely unaware of the syntactic suggar you pointed out. The role of this in JS just became a whole lot clearer to me, thanks for that! — Mene 5 hours ago
 
@BenjaminGruenbaum ok thaks
 
@SmartShovon You must say Hallelujah!
 
@redline Extraction. To properly do it, I needed String.prototype.toUpperCase.call.bind(...) (which was found after a bit of playing around). Generalizing from there was easy
 
5:20 PM
@Gacnt yes
 
@Zirak Oh, so it wasn't jQuery?
BRB bus
 
canvas.addEventListener('mousedown', function(e) {
    mx = e.clientX;
    my = e.clientY;
    for( var i = 0, l = forceEmitter.forces.length; i < l; i++ ) {
        var f = forceEmitter.forces[i],
            dx = (f.x + f.r) - mx,
            dy = (f.y + f.r) - my,
            d = Math.sqrt(dx * dx + dy * dy);
        if( d < f.r ) {
            this.addEventListener('mousemove', moveForce.bind(forceEmitter.forces[i]), false);
        }
    }
}, false);
canvas.addEventListener('mouseup', function() {
any reason you can see why the mousemove event won't remove?
 
@rlemon bind doesn't cache?
!!> function f(){}; [f==f, f.bind(null)==f.bind(null)]
 
@JanDvorak "SyntaxError: missing ] after element list"
@JanDvorak [true,false]
 
You are unlistening a function that has never listened
 
5:24 PM
@rlemon by using bind, you are creating closure to your original function, so now you can't remove the method...have you considered namespacing the event handlers?
'mousemove.myNamespace'
that's only in jQuery though
 
yea, i can just store the object being moved instead of binding it to the method
thanks
 
@Zirak yes, the generalizing is the easy part, but it never really occurred to use .bind on .call since both are functions on Function.prototype and using them together like that didn't really cross my mind
i just get worried at times using all that closure all over the place in parts of code that run many iterations
 
Worry when profiling shows it to be a problem.
 
var forEach = Function.prototype.call.bind(Array.prototype.forEach);
forEach(document.querySelectorAll('div'), function(el) {
    // code
});
that's a common use of call.bind ^
@Gacnt the signature of a function is func funcName(arg1 typeName) (returnType) { body }
(returnType) can be multiple types if it's a multiple-values return function
 
it's cool no doubt, but is there any specific reason to do it?
why not just do document.querySelectorAll('div').forEach? null reference?
 
5:34 PM
@redline how do you call forEach on nodelists?
forEach belongs to Array.prototype
QSA return NodeLists
 
I think I'll stick to [].forEach.call(collection, iterator) for now
 
oh you are correct, that is a node list, i didn't even notice
 
The alternative is to convert a nodelist to an array.
 
i wasn't paying attention to the thisArg at all
 
jsfiddle.net/rlemon/DbbKX/4/show don't look at the code. :)
 
5:35 PM
@loading... which is unnecessary, and it can cause bugs for live lists
 
@JanDvorak then you are wasting your time creating a new array object every time you do
 
@redline negligible compared to the cost of QSA
 
@rlemon uuuugh the code
how can you do that?
 
@FlorianMargaine I recommend not writing code with bugs.
 
how can you code all of this in jsfiddle?
 
5:36 PM
called spaghetti'd it together from a bunch of separate ideas in jsfiddle :P
 
@loading... converting a nodelist to an array can cause subtle bugs
and everybody writes bugs.
 
@FlorianMargaine Should I not recommend that then?
 
@loading... nope. Recommend writing clear and readable code. This way, bugs are less likely to appear, and easier to find out.
 
once the song loads you can move around the (force points)
 
@JanDvorak QSA?
 
5:38 PM
@redline QSA is another one of those things that's only useful in a very specific context
 
I worked as lead of a QSA department for a few years
interesting job.
 
@redline querySelectorAll
@rlemon oh, sorry, didn't notice you trolling
 
I read QSA as SQA :P
then repeated the mistake :?
fun time for all.
 
@FlorianMargaine Okay, I'll bear that in mind! :-) But I prefer @JanDvorak's way of writing it.
 
but what does QSA have to do with creating an array? yes, negligible nonetheless, but still...that's apples and oranges...that's like answering a question with a question
 
5:41 PM
@redline because arrays have lot of useful methods that nodelists don't have
like forEach, every, filter, etc.
 
NodeLists are a stupid idea
 
the DOM is a stupid idea
 
^ and ^^
 
@FlorianMargaine what? i am talking about him using [].forEach and creating an array each time instead of Array.prototype.forEach
the internet is a stupid idea
 
@redline the costs of creating the array-like you iterate are far higher than the costs of creating an empty array
 
5:42 PM
@redline if he transforms a nodelist into an array, it's to do something like els = [].slice.call(qsa('div')); els.forEach()
 
@redline also, if you're worried about performance, you use bare loops, not forEach
 
I don't agree about transforming to an array because nodelist are not arrays. Notably, there are live nodelists, which have different behavior.
 
@JanDvorak on jsPerf it actually has forEach outperforming internal for-loops
 
@redline link?
 
one sec
 
5:44 PM
@Zirak The bot should change the room to gallery when a !!/mute is executed
@redline Not very likely
At least not on chrome and FF
 
I always thought that for-loops were faster, but then I saw this and now I have no idea what to believe...
 
Ah, wait, that's a really crappy test
Whoever wrote the one (I guess-linked to) is an idiot
 
(console.log is really expensive in these benchmarks)
 
ah.
forEach is still faster
 
5:47 PM
There, all updated
 
That makes more sense
 
duh, indeed
 
wait no, that's a shitty test too
 
you're messing with scopes though
one already redeclares a variable
 
5:48 PM
wait, wtf just happened with this test...
 
yeah, that's why
k, all better
 
i still got the same result
 
yeah
compilers can inline the for loops
 
5:49 PM
not sure they can with forEach
 
so 26 million for loops to 1.6 million forEach is correct or in the ballpark for my chrome?
 
+ a function call is expensive
 
ok, here is a good question then
 
@redline let's say it's 50m for vs 2m forEach
 
5:51 PM
i had a very large for-loop, and then i put a large portion of the for-loop into a function
 
@redline Yes
 
so making all these function calls in the for-loop would hurt performance?
 
@SmartShovon Are we still friends?
 
@redline yes and no. Compilers can inline functions calls
 
@Snail 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.
 
5:52 PM
@redline Yes, your for loop would not be able to iterate more than 10 times, 1.7 millions times per second :P
 
because i also had to create some functions in there, and i was trying to keep the variables outside the function definition to a minimum cause the function uses a lot of closure and i wanted to minimize the amount of closure variables as well
 
@redline but honestly, never worry about performance till it hits you. Then, profile.
 
(Premature optimization is the root of all evil)
@redline I like your site's design
 
thank you
and you aren't going to like WHY i am asking about performance
but obviously i need to improve it more and more and more
even 1.8 ms for a class with 100 members and 4 levels of inheritance (400 members) is still too much
 
does banning async:false count as premature optimisation?
 
5:54 PM
@JanDvorak no, it counts as common sense.
@redline here's the thing, you're going to learn the language as you develop your framework, than suddenly realize you didn't even need the framework to begin with :)
 
@BenjaminGruenbaum i'm sorry but you are still wrong lol
 
@JanDvorak it's like "does making one SQL request instead of 50 in a loop count as premature optimization?"
 
@JanDvorak Sync I/O has a very limited set of use cases. I only had to use it once.
 
@BenjaminGruenbaum not because of JS, but because you do not know the full scope of my project
i need jTypes for way more than just JS
i will be using it for some really cool stuff with ASP.NET MVC
 
@redline If I only had a dollar for every guy who said that to me and returned a month later to tell me I was right I'd have a pretty decent scotch by now.
 
5:55 PM
that's actually the first reason i started making it
 
@BenjaminGruenbaum that's quite pretentious.
 
@FlorianMargaine Sure is
 
@BenjaminGruenbaum according to my observation it's really hard to notice the user interaction being delayed by async:false
 
kitten is cute, sleeping on my leg
@JanDvorak let me guess: the web server was on localhost? :)
 
Put my legs up on the other chair in here, fell asleep for an hour, woke up, both legs dead, boss comes in wanting me to do something, told him I can't stand up, tells me when my boner goes away to go fix something, it's the little things that make you enjoy your job
 
5:56 PM
@JanDvorak on localhost it sure is, not that it matters. It goes against the reactive nature of the lanugage
 
@FlorianMargaine no. I was pinging stack overflow.
 
@BenjaminGruenbaum so i think once you see how i actually end up using the library, things will start to make a lot more sense
 
Same. It's fast.
 
@redline What a lot of people find JS messy because of the way interaction with the DOM API is done. If you're coming from a XAML background, I think you'd really like KnockoutJS
 
5:57 PM
However, it could bite quite a lot on mobile, where the network speed is less than stellar
 
@Zirak Thanks dear.
 
@BenjaminGruenbaum yes, i've seen knockout, and i will be putting it to shame
 
@JanDvorak Sync AJAX (outside of its problem domain) isn't just bed because it freezes UI, it practically goes against the nature of the language.
@JanDvorak That's like having a onClick handler that freezes UI until there is a click
 
philosophical issues don't really count when you're coding for cash.
 
you mean like WinForms? lol
@JanDvorak that's exactly what i said earlier about some code i wrote
 
5:59 PM
@redline Ah, winforms, I haven't felt the need to hurl in a while thanks for that :)
 
haha
 
@JanDvorak I'd argue they count even more. What's your source of hope if not them?
 
defining those WinForms in C# was sooo stupid, XAML was a good improvement, too bad it's useless compared to HTML/CSS
 
@BenjaminGruenbaum onclick handler that freezes the GUI, as in, prompt/alert/confirm?
 
gotta go get a pizza. But kittie's sleeping on my legs :(
 
6:01 PM
@JanDvorak Yes, using sync ajax is like using an alert in an actual site. Very small problem domain.
 
1st world problems
 
@FlorianMargaine at least you cvan walk, this must be how paraplegics feel
 
cricket
 
@redline What about Angular, how do you feel about that?
 
also included in my framework
 
6:02 PM
 
all those MV* concepts all have the same things
so i'm sure i could make it comparable to any MV*
 
MVC and MVVM are just two patterns to handle the bigger issue - separation of concerns.
 
the best way i could define mine is MVC2, or MVCW
 
model, view, controller, workflow
 
6:05 PM
!!/google mvc++
 
controller = controller, workflow = client-side controller
 
I like angular, it's MVC - Model-View-Whatever (true story)
 
yep
obviously i have a huge bias
 
6:06 PM
@redline Unless you're doing something very unreasonable with web sockets, you can't really do MVC in ASP.NET MVC (ironic huh?)
 
but it's REALLY cool
i am really excited
think of an ASP.NET MVC4 application that outputs all JS, which are workflows, steps, and views
 
@BenjaminGruenbaum You're more chatty than the norm today :)?
 
all organized using razor and jtypes
 
@redline You're dynamically generating code on the fly?
 
@Gacnt that's cause i'm here
not exactly, i am using really ingenuitive caching
but in essence, yes
 
6:09 PM
!!define ingenuitive
 
@JanDvorak ingenuitive (nonstandard) Possessing ingenuity; ingenious.
 
@redline I really hope you're not generating JavaScript code on the fly. That sounds impossible to test properly
 
i know you don't like the things i make so far, since i have a very short track record
but i think being a C# guy yourself and knowing ASP.NET, you will find this to be REALLY cool
and then see why i actually made jTypes to begin with
just at least give it a chance, that's all i ask
i should be done in another week or two
 
@Zirak What's formula for when you eat McDonalds to when you're going to have to shit, I need a bot command
 
I promise to give it a fair chance, I'm all for oppertunity
 
6:11 PM
believe me, i know that debugging on the fly JS is impossible
and i have completely worked around that
i would definitely like to get your feedback
so we'll see how it goes
 
@redline Are you saying that you worked around that because the idea says it, or because the implementation does?
 
@Zirak can you be a little more specific?
i get what you are saying, but it's still just a little confusing
i mean, it was planned from the start if i understand you correctly
 
Well, no. In the first sentence you say "A is impossible", and then you say "but I worked around that". So did you work around that, or do you think you're going to?
The real question is "how far along are you"
 
package main

import "fmt"

func main() {
    p := []int{2, 3, 5, 7, 11, 13}
    fmt.Println("p ==", p)
    fmt.Println("p[1:4] ==", p[1:4])

    // missing low index implies 0
    fmt.Println("p[:3] ==", p[:3])

    // missing high index implies len(s)
    fmt.Println("p[4:] ==", p[4:])
}
That's pretty cool
 
I would say 80-90% done
i already had a POC done and everything before I started
 
6:23 PM
eh, no point in my point. Time will tell. I don't know what you want to do as well, so I can't really say.
 
i mean, only a small portion of the JS is generated
a majority is still your own code, so none of that is minified in debug mode
but in release, it runs a tweaked minifier to ignore all razor code blocks
so you have regular JS in debug, minified in release, and razor itself has no idea or cares at all about which it is
is that a little clearer?
 
uh, no, as I didn't see your original pitch, I was just pointing out what might be a flaw. So ignore me
I don't exist
 
haha ok
 
@Gacnt Heard of Python?
 
course
 
6:27 PM
@Gacnt so you mean like MatLab?
or python as ben mentioned
 
!!youtube Let's be friends - Manslaughter
 
@rlemon jsfiddle.net/DbbKX/5/show check that one out, that's sick
If the audio wasn't choppy from the JS it would be even neater
 
@EAGER_STUDENT 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.
 
lol
!!s/nsfw-but-funny/nsft-butt-funny/
 
@BenjaminGruenbaum i.imgur.com/rNd7lAs.jpg nsft-butt-funny (source)
 
is that a real ad?
 
it's the internet, you never know
 
6:53 PM
> Composition must be distinguished from subtyping, which is the process of adding detail to a general data type to create a more specific data type. For instance, cars may be a specific type of vehicle: car is a vehicle. Subtyping doesn't describe a relationship between different objects, but instead, says that objects of a type are simultaneously objects of another type.
@FlorianMargaine btw, regarding our debate today on taht question
 
?
reading
 
Your getCar() is composition, not inheritance :-) — Florian Margaine 8 hours ago
 
if you consider a class as being a new type, then composition is subtyping
that's what I meant there
In Java/C#, wouldn't you call this composition? Let's call apples apples. Composition is some kind of subtyping. In JS, inheritance goes through prototypes. — Florian Margaine 8 hours ago
 
Right, but would you agree the following is subtyping:
 
@FlorianMargaine composition would be function getCar(){wheels:4; asVehicle:getVehicle()}
 
6:56 PM
var a = {apple:"Orange"};
var b = {apple:"apple",awinner:"Me"};
Is b a subtype of a ?
 
Composition is nothing more than including a reference to one object within another.
 
I know what composition is, I'm just influenced by the concept of types in Haskell or the likes. You define new types by creating new "classes". So composition is subtyping in such cases
 
Right, but would you consider, in JS, in the above example, the type of b a subtype of the type of a or not?
 
6:58 PM
Why?
 
b has no link with the object a
 
a isn't a type
 
b responds to the same 'messages' that a does.
 
@loading... I can see you've come from Ruby
 
@JanDvorak You're right, I obviously meant the type of b being a subtype of the type of a
nice catch
 
6:59 PM
Heh, Smalltalk actually.
 
var a = {apple: "Orange"};
var b = $.extend({awinner: "Me"}, a); // b would be a "subtype" of a
although it's not exactly the same
 
@FlorianMargaine Now that's just silly
(Mainly because it won't compiler, check the syntax)
 

« first day (967 days earlier)      last day (3987 days later) »