« first day (978 days earlier)      last day (3986 days later) » 

10:00 PM
@Shmiddty isn't she in mexico?
 
@rlemon She's in Canada with me Zirak and copy, we're all in your imagination.
 
@JanDvorak I visit this site sislands.com/coin70/week6/encoder.htm and also this ude the replace space for +
 
Ah, that explains why your all mean to me. :p
 
@rlemon *you're
 
function decode(str) {
     var result = "";

     for (var i = 0; i < str.length; i++) {
          if (str.charAt(i) == "+") result += " ";
          else result += str.charAt(i);

          return unescape(result);
     }
}
 
10:01 PM
@rlemon Taco taco, burrito burrito
 
@OctavianDamiean is this what you suggest? stackoverflow.com/revisions/5655600/3
 
!!> encodeURIComponent('abc+def')
 
@Zirak "abc%2Bdef"
 
@MirkoCianfarani Seems to be working as expected.
 
10:03 PM
yeah @Zirak
 
@MirkoCianfarani that site suggests replacing + with ` ` when decoding, because unescape doesn't
 
!!> encodeURIComponent('abc def')
 
@Zirak "abc%20def"
 
ew
it should use + for space
 
@BenjaminGruenbaum that's not relevant :S I'm not coming at it from a jquery point of view
 
10:04 PM
@david You're coming from an imperative point of view.
 
@Zirak buffalo buffalo buffalo
 
No, i'm not
 
That sentence makes no sense ><
 
people i'm not very good at Math
 
10:07 PM
Nor grammar.
 
would you like to rephrase that sentence properly then?
 
Room, quick poll. Which would you say is the most understandable code, the second most and the third most out of AngularJS | BackboneJS | KnockoutJS? ( Here is KO in JS )
2
 
> Excuse me everyone, I've just realised that I'm not very good at Math.
 
Honestly Angular
 
@BenjaminGruenbaum Angular
 
10:09 PM
Knockout isn't bad either
 
The knockout js one is fine
 
@phenomnomnominal lol, what if I haven't just realised?
 
Either way, you missed a comma, and a capital letter.
 
Anyway Gentlemen. I am having extreme difficulty calculating the following for a JavaScript animation.
 
TIL jsfiddle supports coffeescript
 
10:12 PM
var duration = 2000;
var start = 0; // PX
var end = 500; // PX
 
@Connor what's the issue...?
 
@Connor, do you just want to interpolate between them or...?
 
How can I create an <a href> that doesn't throw anything back into the url after being clicked, but still shows a change of state on click?
currently using <a href="#"></a> which is just throwing everything back into the URL
 
@Connor If you're trying to figure out how many pixels to move per interval (what's the interval?), just divide the difference of start and end by the duration and multiply that value by the interval.
 
Well Gentlemen. the whole objective is to have a currentPoint variable that is equal to 250 when the duration is at 1000
 
10:14 PM
@david I'm not expecting you to just switch sides and agree with me - that's not how arguments work. However, I'd like you to consider building something with Angular and something with Knockout. I've built a big project with Backbone before judging it like I have, and while my view seems one sided I do tell anyone who comes here and asks about an MV* framework to try for themselves before choosing.
 
@DyllenJamesOwens why does it have to be an <a />?
 
(Your grammar isn't improving)
 
Didn't I go through that with you about 2 months ago?
 
@phenomnomnominal LOL
 
@Connor you just want to interpolate.
 
10:15 PM
I remember someone asking pretty much the exact same question
 
@Zirak no
 
@BenjaminGruenbaum DO U REELIZE WUT U JST DID! U CORRECTD ME WEN I ASK THE CODE! HOW DARE! ELITE!
 
@david I don't have direct access to change the a tag.
 
@BenjaminGruenbaum When you used backbone did you use it raw or did you build an abstraction on top of it to handle common tasks like adding subviews?
 
I'm working in a proprietary cms and changing those variables would over all conflict with everything else.
 
10:16 PM
@DyllenJamesOwens what DO you have access to? o_O
 
@david Abstraction, I also tried marionette that kind of improves things and tried the model binder plugins.
 
am i right in saying that the most comming interval is 15ms?
 
lerp = (s, e, t) -> s + t * (e - s)
 
How did you structure the codebase? did you use something like require?
 
@david This is most definitely not the ideal programming environment. I have access directly to the javascript and CSS and XML just not the HTML because it's generated dynamically.
 
10:16 PM
Let me tell you that, I'm not alone in disliking Backbone, it's simply not an attracting alternative anymore. @Shmiddty Is doing a lot of backbone work recently too. We don't dislike it "just cause".
 
@Connor ^
 
@david I used require.js then had a step in deployment that minified with r.js (just like I do in Angular and Knockout)
 
if you take jQuery, underscore and underscore templates away from backbone, what do you have? EventEmitter? :P
 
@phenomnomnominal what does the lerp stand for?
 
it's just completely full of fluff
 
10:17 PM
the main reason I'm not liking Backbone right now is because it's just not as intuitive as other MV* frameworks.
so other devs are producing sloppy code
 
where s is the start, e is the end and t is the time from 0 to 1 across the period
 
Maybe you were just expecting too much from it then
"Backbone is a library, not a framework"
 
@Connor lerp is short for linear interpolation
 
according to the site at least
 
could I through a type="button" inside the <a> tag to have it not throw anything back to the server?
 
10:19 PM
I don't much like the look of Knockout if that example is typical, @BenjaminGruenbaum. Some of the presentation logic is in JS and some of it is in the HTML inside strings.
 
@david All I'm saying is - consider your options. I've read a bunch of Backbonejs books in the past and learned it, I read most of the code base. I just don't like it very mcuh.
 
The reason I like it is that it adds a little bit of structure, but I could probably remove it from my projects and have them still working in a day or two
 
@montogeek 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.
 
@loading... What logic would you like moved?
 
@david backbone is awful
2
 
10:19 PM
lol who starred that
 
Oh, right. Thanks for helping me @phenomnomnominal, i am truly grateful good Sir.
 
@phenomnomnominal that seems to be the common conception in this room
 
Thank you to @Nile sir
 
@david only based on using it every day for the last 6 months
 
@david All I'm suggesting is 'try other options'.
 
10:20 PM
@BenjaminGruenbaum Iteration over the questions is in HTML, whereas setting of status is in JS.
 
@loading... That's because the status is observable and changes, I can't set it in HTML since it's part of my view model (actual data). All the 'code' in the HTML does is tell it how to lay out, think of it as a Mustache 'iterator' or whatever templating engine you like.
 
@BenjaminGruenbaum That's why I started this discussion, I was hoping for someone to mention something that would make me want to try another option
 
@phenomnomnominal sorry to bother you, I'm guessing that the t is the duration?
 
but all you've done is put me off angular even more :S
 
not the duration
It interpolates between 0 and 1
 
Rao
10:22 PM
Que on implementing fb open graph: Does anyone know how to include more than one image url in <meta property="image" content="http://www.foo.bar/foooo.jpg" /> Should I use comma separated urls in content or should I write multiple meta image tags?
 
where 0 would be the start time, and 1 the end time.
So if you start at 0ms, and end at 2000ms, and want 1000ms, you would use t = 0.5
 
@david Angular gives you data binding, a consistent API, wide support, lots of plugins, very rapid development, declarative syntax and more. All I'm saying is 'try your options. Build a project in Angular and in Knockout and see for yourself.
 
@Connor It's essentially currTime/time
 
Oh, so var t = currentTime / time; then
 
as long as currTime = +new Date - startTime
 
10:23 PM
@david I think the big draw to Angular is that someone can look at the code and quickly understand what it does.
 
@Connor, but you probably don't want to use Date for animation.
 
ok i got it, thanks everyone :)
 
That's subjective
 
@phenomnomnominal just take away the interval from duration then?
 
10:25 PM
yep
 
@david Right, but we polled this room (and trust me, we disagree here a lot) and everyone chose angular over backbone.
 
@phenomnomnominal how do i thank you both?
 
@phenomnomnominal why?
 
Allow me to continue to ridicule you as I see fit?
 
10:25 PM
I agree that it's subjective, but generally speaking based on anecdotal evidence Angular is more readable
 
@Nile, because they're completely innacurate and we now have requestAnimationFrame?
 
@phenomnomnominal There are reasons not to use requestAnimationFrame though
 
@phenomnomnominal What!!!!!
 
@BenjaminGruenbaum I see no need for putting code in strings that could just easily be in JS along with the other display code. And there's an inline click handler which would be frowned upon if it were written in JS. (I don't like templating engines either.)
 
so i have a choice?
 
10:26 PM
@BenjaminGruenbaum but you have to admit it makes sense for animation
 
requestAnimationFrame should be used for the animation loop... logic is another story
 
@loading... How would you write it?
@phenomnomnominal I admit it, but jQuery don't
 
Defining animations in terms of frames makes so much more sense than in terms of dates
 
@HarshVardhan 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.
 
@BenjaminGruenbaum...
 
10:27 PM
@phenomnomnominal They used it and dropped it, because if you navigate to another tab it messes up
 
@phenomnomnominal mdn says AnimationStarTime only works for moz
 
I don't know the use case, but you should separate logic with rendering (in most application) and run the rendering with requestAnimationFrame and the logic in a loop befitting of the application.
 
@BenjaminGruenbaum Probably not a lot differently conceptually, just in pure JS. Yeah, I know, not very fashionable.
 
@BenjaminGruenbaum if you separate the logic then the rendering should fall in line when they tab back on
 
@Nile, I just mean you should keep track of frames and update your animations on a frame by frame basis
 
10:29 PM
@rlemon yeah, the reason they had to roll back was because sooo many people were doing it wrong
 
@phenomnomnominal But then how can you calculate how many pixels to increment something if you want it to reach x width in y seconds?
 
You don't, because the idea of seconds is dumb
 
function update() {
  .. stuffs
  setTimeout(update, UPDATE_TIME);
}
function render() {
  requestAnimationFrame(render);
  .. stuffs
}
^ how I do
 
So your animation runs at different speeds on different clients?
 
a timeout loop keeps running if the tab isn't active, right?
 
10:30 PM
yes
 
first thought: a simulation
 
RAF doesn't
 
@rlemon right, I knew that for sure
 
@Nile, yes and that's completely reasonable
 
10:31 PM
Some browsers also start throttling setInterval. Chrome only fires it once a second I think
 
nahh chrome uses what you say for the most part
I had that bite me in the ass
 
@phenomnomnominal What about for things like games and slideshows?
 
Still completely reasonable
 
Shame there is MariaJS missing in the poll (the only real GoF MVC) :)
 
And if it's not, you can so a pretty simple evaluation to work out how many frames to skip
 
10:31 PM
What about if you have physics calculations @phenomnomnominal?
 
left a demo open that generated enemies in a setInterval and tabbed off and tabbed back in like 10 minutes..... :( yikes.
say you are tracking particles, the update loop runs while you tab off and all the render loop does is render their position. While you are off tab the particles are moving still, but not rendering, when you tab back to they will appear in their new position. You MIGHT see the jump... but you tabbed off in the middle of a damn game!
 
@san.chez Go ahead and add it! Write a MariaJS version and we'll add it!
 
@phenomnomnominal Hmm... where'd you hear about this? I've only found things that use dates
 
tracking a deltatime is one thing. Using it to run your render logic loop is another.
 
chrome throttling interval caused me the longest debugging session ever
 
10:33 PM
I didn't hear about it anywhere, I just thought about it for a fraction of a second
 
@Esailija That.
 
in media player app I was using interval to do cross fading
and sometimes while listening to music, it went to hell because of throttling
and it took a while to notice it happened only while I was on other tab
and of course only when songs changed
 
hrm.
 
@jgb 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.
 
maybe setting up a new timer did something to throttle it?
 
10:34 PM
@rlemon fiddle?
 
I dunno what we're talking about but my bug was caused that when you are not focused on a tab, all intervals take at least 1 second to exceute
and that affects music cross fading cos you can still hear it when you're not on the tab
 
but I have since increased the timeout
and still am using setInterval tho :/
 
I fixed it by using the onprogress event of the audio element which is not throttled
^^
 
eh, I'll test it later. I could care less right now
 
@BenjaminGruenbaum Yeah, I'd like to see that too.
 
10:37 PM
but I still say separate your rendering and your logic loops. rendering should def be done with requestAnimationFrame
 
@Nile, I just don't see how you could think it is at all natural to use Dates for animation. It's a hack.
 
logic. - your choice.
 
@phenomnomnominal using a deltatime to do sprite movement is not unheard of
 
Yeah, I know
But in the general JS case - aka animating elements, using dates is stupid.
 
10:39 PM
yea
but I think jQuery does it for their animate no?
 
Probably
 
well there is performance.now()
 
And basing everything off the assumption of 60fps is so much easier
@Esailija, only in chrome right?
 
which is not affected by user changing system dates etc
but other than that you have to use Date.now()
 
nice
 
10:40 PM
And obviously meant for monitoring performance, not timing, right?
 
@phenomnomnominal It's just that I've seen most people suggest it. How would you calculate how much frames to lag/skip without using date?
 
also if you use RequestAnimationFrame, you get some kind integer as argument I believe
 
@Nile, the ratio of actual frames per second to your idea fps
 
also, how often does a user change their system clock during an off tab while animating?
 
@phenomnomnominal I see
 
10:41 PM
ok so RAF callback gets timestamp as argument too
 
game over :(
 
lol
 
> Backbone was a great library two years ago, but I am convinced that there are better things now. I believe that many people choose Backbone just because of its popularity, it is a vicious circle.
 
what is big deal about 30kb gzipped js files when if I have to put retarded 900kb designer images on the pages anyway
 
@BenjaminGruenbaum Just realised there is no need for any controller for this code example, so it would be similar to backbone
 
10:49 PM
does any one use asm js?
i dont get what it is =/
 
2
Q: How do I make good guy attacks only hit bad guys and vice versa?

tieTYTMy game has many different type of good guys and many different type of bad guys. They will all be firing projectiles at each other but I don't want any accidental collateral damage to occur for either alignment. So bad guys should not be able to hit/damage other bad guys and good guys should n...

1
Q: AJAX issue - Uncaught SyntaxError when processing Zip File

voodooGQI'm creating an application that will allow a user to fill out a form and then have a customized zip file downloaded for them upon submit. I'm utilizing AJAX to accomplish this task. Build.prototype.ajaxHandler = function(method, values) { jQuery.ajax({ type: 'POST', ...

 
it's a mode in javascript where you only have basic arithmetic and logic operations on numbers
 
iz fast
iz rly fast
 
well yeah but it needs structs and strings
 
and you shouldn't be writing it manually
 
10:54 PM
so is there only some situations when you should use it ?
 
and arrays, does it have arrays?
 
typedarrays
 
prefer the levitate one @rlemon better song :P
 
@Dave well for instance making a mp3 decoder in javascript
 
10:55 PM
@Dave just drop the kicks.html then
@Esailija wanna write me a mp4 decoder?
 
no thanks :P
 
hehe
Darkyen wanted to write one but I figure i'll wait 6 mo for proper native support
 
That's cool, do you have a version that uses the webcam?
 
I can....
just need to adapt this
 
If you see anything obviously wrong tell me
 
11:04 PM
maybe he should know how to use new and why it's useful then
 
so should i update my game code to asm for performance gains or will i experience some down falls doing so ?
 
@Dave probably not unless you are seeing some serious performance issues in certain areas.
 
@rlemon heres a challenge get the data of changing pixels to make a duplicate of the guy dancing so you see two of him in the same video :P
 
drawing to canvas and the rich object interaction is not something asm.js helps at all
 
11:07 PM
how are you doing it now?
 
well mine is all canvas based =/
 
yea
 
so asm is useless for me then =(
 
and thats all i've been working on for the last little bit in my spare time
 
I guess if you threw all objects away and just used offsets in an array but that is seriously obfuscated
 
11:08 PM
what code is causing you grief :P
 
drawing to canvas
 
and how are you doing it right now.. and what part about it is causing issues
 
its about 90% of time of the snapshot
 
show code man!
 
ok hold
 
11:11 PM
@Esailija What? (about the singleton)
@BenjaminGruenbaum the module example is exactly the same as singleton.. the singleton example is just a convoluted way to do the same. — Esailija 1 min ago
A singleton means you only have one of it, it's an untestable anti pattern.
 
I am talking about the examples
 
Which ones? The Addy Osmani ones or the ones he linked to or the ones in the question?
 
heres my draw function pastebin.com/L937SzgK
 
@BenjaminGruenbaum heh. You should probably mention that this means different things, and I'd link to the spec (the [[construct]] link goes to js garden as well, and you should like to where new NewExpression is specced)
 
11:13 PM
and in this case, the module exports a singleton, not a constructor you make multiple objects of
 
@Zirak Wait it does :O [[construct]] was supposed to go to the spec
 
I have a math question. Say I'm traveling with direction and velocity given by v, and get an order to move to a target at position t. What is the best direction to accelerate in?
 
The vector towards t?
 
Is "pulling a Zirak" putting a lot of effort into answering a question, only to have a lazier answer be accepted?
4
 
physics.stackexchange?
 
11:14 PM
@Zirak that will cause you to circle the point
 
or maybe maths.stackexchange?
 
or spiral inward if you have drag
 
@Esailija That's not the module example I used :P Where did you get that?
@Shmiddty Yes. (also, walking through the spec)
 
@BenjaminGruenbaum from your comment, it's the first link you gave
 
@Shmiddty haha, that's a bit depressing. I thought it meant "describe something in a hand-wavy way, and then link a lot to the spec"
 
11:16 PM
@BenjaminGruenbaum have you worked with chaplin.js?
 
I suspect you need to find a vector a such that the projection of a + v onto the vector towards t is maximised
 
!!/youtube white rabbit jefferson airplane
 
@Esailija Yeah, not what I meant :/
@Shmiddty nope, never, sorry.
 
!!/youtube there is no need to be upset
 
11:16 PM
 
Man, I do have some awesome unaccepted answers, or ones with like 2 upvotes.
 
@Shmiddty What is it?
@Zirak We all do :/
 
@BenjaminGruenbaum It's a plugin for backbone: github.com/chaplinjs/chaplin-boilerplate-plain
 
@Esailija P.S, singletons are evil :P
@Shmiddty How is it?
 
!!/youtube fortune son ccr
 
11:19 PM
@BenjaminGruenbaum haven't actually tried working with it. It looks like a step in the right direction, though
 
everyone needs them some CCR
 
If you're doing corny songs...
!!/youtube freebird
 
11:21 PM
And this biiiird you canooot chaaaange
Lamers. Should've been "and this bird you cannot chain"
room topic changed to JavaScript : New User? Read rules.javascriptroom.com | evil(drama); [consistency-of-suckiness] [ecmascript-5] [javascript]
 
home time
 
!!/youtube rise against prayer of the refugee
 
@Zirak The room is one of the most awesome movies ever.
 
now that is just a good GH song
 
11:24 PM
@BenjaminGruenbaum I did not hit her, it's not true. Bullshit. I did not hit her. Oh hi Mark
 
@Zirak Hi doggy
 
@phenomnomnominal I feel we should jump in here
Donde, está, la biblioteca. Me llamo T-Bone La araña discoteca.
 
@rlemon ^ you know theyre my favourite band right?
 
lol
i do now
 
and they're the nicest fucking dudes in the world
(Rise Against I mean, not Troy & Abed)
 
11:31 PM
you're talking about rise against right?
lol
at first I was like..... ummm...
 
yeah they've been my favourite band for like 10 years now haha, they're the reason I bought GH in the first place!
 
LOL
Just the "Right .. oohohohoho" that made me lef
 
lol did he even read the error message
 
LOL
I'm upvoting your answer, but closing as too localized
@Kolink I don't understand this 'writing your own code' that you speak of, is there a jQuery plugin for that perhaps? — Benjamin Gruenbaum 3 secs ago
There is no advantage to this over what the OP is doing though. If you place methods on the prototype you get inheritance, generic methods and don't have to allocate N*2 (function object + prototype object, also a pointer to the function object) extra objects every time you create an instance. — Esailija 11 mins ago
LOL @Esailija , I'm sorry I said you're a performance junkey :P Thanks for proving me wrong
 
lol it's generic advice
if you don't create a lot of objects it doesn't matter but if you do then it kinda matters if an object takes 10kb or 100 bytes
 
11:44 PM
His code is bad for other reasons.
this.get_honkCount lmfao
 
and the 2 other good points have nothing to do with performance
so I'm just 33% junkey
denial is the first step to cure
 
and why did he change the natural getter to artificial one
does he secretly know that natural getters force you into hashmap mode?
haha
 
@Esailija He probably does.
 
mixing underscore and camel case ftw too
 
11:49 PM
You just don't get it :P He is the genius here
 
and I think he might be under the impression that the OP's function doesn't create distinct contexts
that's why his example is creating 2 cars to show they don't share a context
rofl
 
You got to love how he starts:
> Someone copied a trivial example of Closure in javascript.
 
ah mixed in arrogance too... the wtfs don't ever end
 
I figured you'd like him. He is 'Chief Software Architect" somewhere
They do state government systems. Enterprise, I figured you'd love him :P
 
what is the url of the stuff you guys are talking about?
 
11:53 PM
0
A: When should you use a constructor in JavaScript?

Jack D MenendezSomeone copied a trivial example of Closure in javascript. The reason to use new with the function is to create a closure, but this is a useless example. Here is a better way to use the Closure. Notice that honkCount is only accesible to the two methods honkHorn and get_honkCount: function Car...

 
well specifically the bottom most answer
 
oh this one again, thank you Benjamin
 
I keep posting wrong links today :/
 
This is a hands-on position programming in an ASP.NET 4.0 using RadAjax tools from Telerik and jquery. The core application is an Ajax UI dynamically generated from meta data in SQL Server. I've written JavaScript prototyped objects to support the complex UI. I am also providing management of the product and team. I am implementing Software Engineering best practices for the company.
The application is very heavy considering that it is browser based but Ajax makes for a very satisfactory user experience. I also did the CSS and HTML design for the application. Programming is in VB and JavaSc
Buzzwords much
 
How is jQuery a buzz word?
How is saying you know jQuery imply anything about your skill? It's one of the easiest APIs to learn and the best documented...
 
11:59 PM
Isn't that the definition of a buzzword?
 
Then again I see it in CVs often.
Often people say they know jQuery.
 
jQuery AJAX HTML5
 
Maybe I do too, I haven't written a CV in a while
 
the buzzword trifecta
 

« first day (978 days earlier)      last day (3986 days later) »