« first day (419 days earlier)      last day (4519 days later) » 

12:00 AM
@MianKhurramIjaz, the model instance that fetch is called on should somehow change it's state, which fires an event that the state has changed that you listen on the view
 
inside the model ?
 
are you parsing the request at all to actually change the model's state
 
@jAndy your "design decisions"
 
hmm does that mean all the json params which i am expecting this model to receive from the server should be updated manually ?
wait i update my code for you to look
 
@Raynos: talking about the architecture or inheritance/composition decisions ?
 
12:01 AM
yes you need to provide a blueprint to the model on how to handle the request from server, IE how to update its state from a request
 
@Raynos not specifically js, but js is okay, I'm thinking not so much libraries as coding design patterns (dependency injection, etc)
 
@jAndy the high level design is rock solid. Some of the implementation details annoy me.
@Anfurny nothing has changed in the last 3 years. Nothing major anyway
 
user1385191
I have git on OS X
 
The only thing that has changed is what the herp derp bandwagons find the popular thing to do
 
12:02 AM
@MianKhurramIjaz, you provide this blueprint in the models parse method
 
HERP DERP MVC IS TEH BEST
 
@Raynos: Yea, me too. But as I mentioned, I guess I'm going do shift that
 
models parse method
?
parse: function() {...} ?
 
@Raynos Okay, let's say I wanna be aware of what the so-called "herp derp bandwagon" is touting, any resources?
 
12:02 AM
@MattMcDonald that should work, again simple use of add and commit will do
 
    var fileModel = Backbone.Model.extend({
        name: null,
        token: null,
        parse: function( response ) {
//do something with the response
},
        url: "http://localhost/CodeIgniter_2.1.0/index.php/storage/list_container_objects"
    });
 
@Anfurny nop :D. Seriously though if you want "whats best practice on X" I can answer that
 
user1385191
I was shocked when I committed changes and vi popped up
 
excellent i undertand you
thanks
 
If you want a diff on "best practices of the interwebs" between now and 3 years ago, no luck
 
12:04 AM
now in the parse function you will change the model's state via this.set etc...
this automatically fires an event that views listen to
 
I just want to look like I majored in CS, when I'm self-taught, for a job interview. I wanna make sure I'm 100% on best practice and not hack/slash @Raynos
 
is CS = C# ?
 
@jAndy Computer Science
 
lovelly i code it
 
@Anfurny that ain't easy. You can't fake that
 
12:05 AM
oke
 
write completely shit code = faking CS major
 
Also having a degree in Computer Science has nothing to do with knowing what's hot in industry
It has everything to do with knowing the basics.
 
user1385191
compsci is not a requisite
 
That means C, that means data structures, that means algorithms, that means hardware, that means parallelism, that means LISP
You dont need compsci to be a developer though, it does help
@jAndy did you see the modularity link?
 
user1385191
I'd probably have a better idea of what I'm doing if I took compsci
 
12:07 AM
@Raynos: yes, I was unsure. It reads a little like hacking/tricking something into that modul8 thing which actually is not supposed to be
 
how would i loop it because i receive array of json nested how would
 
but then again, I have no experience with that lib
 
@Raynos Well I know, C, data structures, algorithms, hardware, a bit of threadding, and don't care about lisp. I'm more concerned with the little things like "dependency injection"
 
inside the parse: function(response)
three files with their data is to be listed on the view
 
JSON.arse() // if you want to insult a co-worker secretly
better works if his first name is Jason
 
12:09 AM
@jAndy its more about CommonJS require
 
so the fileModel is representing multiple files?
 
and how it's a great way to handle modularity in the js world
 
I think you need a collection of fileModels instead
each representing one file
 
@Anfurny dependency injection is weird, ignore it.
 
hahahah :)
 
12:09 AM
@Anfurny if you really care read : martinfowler.com/articles/injection.html
@Anfurny if you want moar buzz words read the design patterns book
 
yes
i do have a collection defined
 
@Raynos: CommonJS is so dead when es.next will have its first implementations
 
so fetch a collection instead and in the collection parse method when it receives an array, update each model in the collection
 
RT @jamespearce: Building [Mobile Web] Games that Run on Poor Connections: https://developers.facebook.com/blog/post/610
RT @cramforce: MDN docs in new clothes http://dochub.io/ Nice. Who made this?
RT @w3c: RDFa Lite 1.1 Draft Published; RDFa 1.1 Primer Updated http://ow.ly/1g4eJo
 
@Anfurny the hottest recent thing of course is node ;) so knowing about node and evangelizing it is good
 
12:14 AM
does the parse: function also exisisit in collections ?
 
haha
 
yes and fetch
 
Esailija
:)
i copied the parse: code from model into the collections but it is not doing any alerts
 
@Raynos: any thoughts about the deadlock problem in node ? That is one thing I currently have the most headache of, when implementing stuff @office
 
@jAndy deadlock?
 
12:16 AM
where should i create collection inside the model ?
 
you mean circular require calls?
 
@Raynos: I mean, the general problem which any event-loop based system has. Even if it cannot get blocked by spec and design, it still might happen through bad code or unexpectable failures. And if that happens, you'll hold the complete show right?
 
@jAndy the term "deadlock" normally means two threads are waiting on a pair of locks and neither will release the lock until the other releases. This does not happen in node
 
imagine that in some kind of server which deals multiple clients
@Raynos: I meant a while(1) problem
 
Oh you mean blocking the event loop?
That's easy
 
12:18 AM
@MianKhurramIjaz can you show what you have now
 
Don't write bad code.
 
@Raynos: as I said..
 
whats the real problem?
 
@Raynos: if it happens for whatever reason, there is nothing you can do about that, can you
 
Are we talking about deploying code in production with a blocker
 
@jAndy there's nothing you can do about it in any language. This problem aint unique to node
 
@Raynos: I mean, a server like nginx or apache will just crash/block/hold one thread, maybe even only one client
but node, will stop the show for all connected clients
 
@jAndy you realise only an idiot runs a single node process in production right
 
@MianKhurramIjaz, you are doing fetch on a model instead of collection
 
You use cluster and you run a cluster of node processes with a load balancer in front
 
12:20 AM
@Raynos: regardless howmany nodes servers you're running, all currently connected clients would get screwed no ?
 
oh my GOD
 
If you want you can make the cluster clever and have it periodically ask the worker processes for whether their event loop is clogged
@jAndy all open connections get screwed. Any data persisted in memory is screwed
there are plenty of techniques for worker reboots
 
@MianKhurramIjaz, there are many tutorials on backbone that show you how to get started with collections etc.
 
but any data in RAM is gone.
open connections are fixed with clever reconnection logic
 
@Raynos: it sounds scary
 
12:21 AM
@jAndy dont use RAM as a database. Problem solved
 
@Raynos: that is where threaded servers really have an advantage
 
Seriously, any proper setup fixes this problem
 
i got every thing fixed up
i appreciate and regard you Esailija
 
@jAndy you can work around it in a recoverable manner, by abusing v8's internals
 
you have a lovely WHOLE LIFE with happiness
 
12:22 AM
well, I'm sure about that. Still far away from beeing as experienced in node as I would like to be
expecially with setups and configs
 
@MianKhurramIjaz, but you are still doing many things wrong which will cause problems in the future
 
The only real issue is that when a worker goes down, everything in RAM goes down
but that's a non-issue
 
like fetching an element in class declaration
 
because you shouldn't store anything that has to be "safe" in RAM
 
class declaration should not be dom dependent
 
12:23 AM
@jAndy the same problem happens when your unix box crashes. Exact same problem. Whether its running Java or PHP. if the server crashes its game over.
 
@Raynos: however, I'd be curious. To have a simplistic example, just a little chatserver on node, who holds a max of like 30 connections and dispatches messages through the clients
 
yes please throw light
 
if anything 'bad' happens, the chat is basically over right
 
var myFileView = Backbone.View.extend({

    el: $('#gs-file-list'),
 
@jAndy interesting, should be 100% do-able
 
12:24 AM
i want to fix the bad thigns and still how to generate those this.set functions inside the parse in a loop ?
 
you'd probably also want to capitalize constructors
 
the only issue is that servers crashing increases latency
but you can't solve that one. You can have a 100% no data loss, unless everything goes down
 
what is wrong with var myFileView = Backbone.View.extend({

el: $('#gs-file-list'),
 
@MianKhurramIjaz inside collection.parse you can do:

this.each( function( model ) {
model.set( ... )
});
 
I mean if your running this on a cluster, and every box on the cluster goes down at once. You might be fucked. Not sure
 
12:25 AM
@Raynos: does node realize infinite loops itself ?
 
@jAndy no.
Seriously though infinite loops shouldnt happen :\
I dont know how you could possible not catch them in unit tests
 
@MianKhurramIjaz, well it finds the element in the page and you are just extending
replace with '#gs-file-list'
 
@Raynos: absolutely agreed, but.. "should not" is a little vague
I'm just poundering about this "problem". I mean you're talking about clusters and big setups, sounds a little "big" to avoid all those possible problems
 
this.set is not a function inside the collections parse: fucntion ?
 
nope... set is for an individual model
 
this.each iterates all models in the collection
 
@jAndy I know what you mean but, this is a very difficult problem to solve
 
@Raynos , can i pick your brain a bit ?
 
if a particular node worker in spinning in a while(true) loop (@tereško yes) then can you trust that worker hasn't corrupted any state?
@jAndy basically is it safe to reboot an inactive worker. How do you determine an endless loop and a long/slow operation?
 
its the same issue on all "cooperative multitasking"-like systems since day1
no real threads, does not solve all problems
 
12:30 AM
@jAndy you know Object.freeze kills performance by 90% right?
 
Esailija ?
 
this.each(function(model, index) {
    model.set({
        name: response[index].name,
        content_type: response[index].content_type,
        bytes: response[index].bytes,
        token: response[index].token


    });
});
 
0
Q: Remove Javascript generated by Comments

corymathewsIn a theme I am working on the comments form adds javascript to the header. <script type='text/javascript' src='http://[URL]wp-includes/js/l10n.js?ver=20101110'></script> <script type='text/javascript' src='http://[URL]/wp-includes/js/comment-reply.js?ver=20090102'></script...

 
@Raynos: I read about that in that SO question
@Raynos: kills the performance by 90% on every access to the frozen object?
 
its a random average i choose
I dont know what the real numbers are
but at least a factor of 3 on chrome.
I think firefox is same performance
 
12:33 AM
@Raynos , ok .. i hope you are familiar with role of datamappers in MVC-ish architectures
At the initialization ( bootstrap) i have two objects interacting : instances of Request and Dispatcher
- Dispatcher is for application routing
- Request holds the "deciphered" data sent from browser and the related method
so , the question is :
 
makes no sense actually
what would it take longer? should totally be the same
 
Thanks So Much but the view is still not getting populated and giving errror :content_type is not defined
[Break On This Error] var func = new Function('obj', '_', tmpl);
 
should i create instance of Request and pass it to Dispatcher inside fetch method ( mimicking the datamapper API )
 
i have learnt today how to use backbone.js for last 3 days the documentation was confusing me till i chat with you
 
yeah the docs are shit that's why you should read code from simple apps designed backbone way
 
12:34 AM
or , should the Dispatcher return an instance of Request , when i call get_request() method ?
 
@jAndy bugs. Bugs make it slow. I assume the JIT doesnt know how to handle frozen objects
 
@Raynos , any opinions ?
 
@tereško Dispatcher has a hash of <urlObject, routeHandler> right?
 
@MianKhurramIjaz, scroll to bottom documentcloud.github.com/backbone there are many example apps
 
You should simply pass the Request instance as a parameter to routeHandler like node.js does
 
12:36 AM
@gsnedders: open that opera source code and check what the implementation does with frozen objects :p
summoning
 
@MianKhurramIjaz, some have great tutorials that go through the code... don't remember which though :P
 
@Raynos well , it takes th URL , and matched the Route , then using Route's rules ( regexp ) it extracts information from URL
 
RT @mozlabs: Video w/ @dangoor: new dev tools in FF Aurora - page & style inspection features, web console & scratchpad http://t.co/bX ...
 
@jAndy I'm refactoring BarFoos.

- "I dont see the point of this function. `<delete>`"
- "I don't see the point of this function either. `<delete>`"
- "Or this function `<delete>`"

Man this refactoring thing is easy :D
@tereško so what handles a request? The request handler needs to be invoked with the instance of Request.
 
what is this <delete> stuff :p
 
12:40 AM
0
Q: How to start designing with (open) data and JavaScript, for dummies?

João RamosI've been designing data-driven interfaces (mostly graphic, low fidelity and non-functional prototypes) for over a year, to be implemented using JavaScript libraries such as d3.js. Although I'm a web designer by education, I've never actually coded any data visualization. Are there any crash-cou...

 
the delete button is the greatest refactorer of all
:P
 
lol
@Raynos: does module8 require a server script in order to work ?
 
@jAndy modul8 is a build preproccessor
so you replace your ANT/MAVEN Java build thing with a node build thing
 
@Raynos: meh
 
12:45 AM
it has a CLI but I just write a little buid script and do node build.js
 
Esailija: why i do not have model inside my view it appears as if the change event is not getting triggered through the collections ?
 
hmm @jAndy, do you actually make ajax request for each module everytime ?
 
@Raynos: I don't know really... ant is pretty powerful
 
@jAndy yes it is, but modul8 is a small tool with a single purpose, modularize your javascript.
You can only be sold once I refactored the entire thing
 
@Esailija: not really, only for optional modules which are loaded by feature detection
 
12:46 AM
which is pretty hard without tests or comments or documentation :D
 
@MianKhurramIjaz, have you instantiated the collection class and added models to it?
 
@Raynos: I also don't think you can compare that really. my ant buildscript is doing all the ugly work.. minifying js+css files, concat them, auto-replace the links in the index.html, strip comments, fix images, etc. etc.
like a true awesome static build process
 
I also don't see any listening for change events
 
@jAndy modul8 does a small subset of that. You use other node tools like uglify and minify for the rest
 
12:49 AM
I see no reason to re-write all that stuff in node, just to have it in node. infact, ant is pretty cross-os right now
 
yes the Collection class i instantiate and call the .fetch() through collections
 
have you done console logs inside the this.each loop to see if anything is happening
 
how do u listen to change event ? change: function () i thought the change event automatcially gets trigeered when u call this.set on collections ?
 
yes it gets triggered but you need event listeners
like click gets triggered but it does nothing if you don't have onclick somewhere..
 
@jAndy there is no reason to do it. I'm just throwing it all away because I dont need it. I also dont minimize libraries. You want it minimized? Do it your damn self
 
12:53 AM
@MianKhurramIjaz

Collections are ordered sets of models. You can to bind "change" events to be notified when any model in the collection has been modified, listen for "add" and "remove" events, fetch the collection from the server, and use a full suite of Underscore.js methods.
 
I wrote ant scripts for both, production and debug scripts
 
@jAndy you use tabs ;_;
 
it doesn't matter what you use as long as the whole codebase is consistent
 
@Raynos: have to work with eclipse@work, normally I do everything with panic's codA which is able to handle spaces well, even on backspace, but eclipse.. screws you
so I decided to go with tabs, its not that bad
 
i am lost now
 
12:56 AM
@MianKhurramIjaz, yeah I recommend reading a lot of tutorials until it all starts making sense
 
model.set({
name: response[index].name,
content_type: response[index].content_type,
bytes: response[index].bytes,
token: response[index].token
});
model.set would should cause the change event to fire
?
 
Backbone.Model.prototype.trigger = (function(){
var old = Backbone.Model.prototype.trigger;

    return function(e){
    console.log( "model event triggered: "+e );
    return old.apply( this, arguments );
    };

})();
now look at your console and see the events are firing
 
@Raynos , the solution for my issue was "you are doing it the wrong way around .. again"
 
you just need to add listeners
 
@tereško ok o/ Have you tried using node.js instead?
 
12:58 AM
@MianKhurramIjaz, that code is just for debugging, don't do stuff like that in real code of course
 
but i do not see any events in log gettting fired
where u want me to paste that code ?
 
@Raynos , no , but i have another idea for which i might use node.js ( or maybe erlang )
 
right after backbone.js source
it alters the core function
 

« first day (419 days earlier)      last day (4519 days later) »