« first day (418 days earlier)      last day (4524 days later) » 

12:02 AM
0
Q: Code structure for a file reader/writer in JS

XananaxI am writing a file writer/reader in javascript; I want it to work on local files. It tries to use Firefoxes XpConnect, falls back on IE activeX, falls back on java LiveConnect, falls back on a java class (not included here), falls back on HTML5 local filestorage. I also want to throw in there a ...

 
@ThomasBlobaum you are the best \o/
 
o rly
 
mumble mumble mumble
Stupid stale vanilla beans
 
@ThomasBlobaum async underscore. It makes so much sense
im writing it now
 
good! please put tmpl3 in it too
 
12:14 AM
No
 
you'll do it later ....
huehue
really tho, i will use it if its good
dont forget to tag meh!
 
"tag meh" ?
 
you should even just call it 'async-underscore'
 
no ._.
 
12:17 AM
Its going to be an extension on after
Meh async already does all this :\
 
need to work on your namings
async does some of it
the idea is to match that fucking API like as close as possible, to the character
 
No, there's not much point in that
 
you'd be surprised how much time goes into API design
respect
async.js does a lot
 
Yes it does
 
See, the exposed parts of underscore are almost all async, except for some methods that require you return something, like filter and sort
andreject
aside from these you should be able to match the API
that's what i'd do anyways
then you can use half of the underscore stuff out there with your own lib
its like free code $$
 
12:24 AM
Aha.
 
Its more than that, though, its also all the people that want it but dont want to context switch because they use underscore in the browser
 
async doesn't work on objects.
Thats a major flaw
so I can fix it with after :)
 
those people will then follow your shit
 
// underscore
var result = _.map(set, function iterator (value, index, set) {
  var newValue = manipulate(value);
  return newValue;
}, optionalIndex);
doStuff(result);


// after
after.map(set, function iterator(value, index, set, callback) {
  var newValue = manipulate(value);
  callback(null, newValue);
}, optionalContext, function finished(err, result) {
  doStuff(result);
});
@ThomasBlobaum what do you think about API ? do be async we need callbacks
 
just add a callback to everything
instead of return
 
12:33 AM
Pretty much.
 
underscore api + a callback on every method where you'd expect it to be + everything else in the exact same spot
 
Yes
a strict subset of underscore though
 
Theres plenty of stuff in underscore which just does not make sense to be async
 
extend, bind, bindall, clone
start with these
 
12:35 AM
No
bind is ES5. That's not needed
extend is in pd.extend
clone(obj) is just extend({}, obj)
 
you are missing my vision
 
All those operations have no business being async
 
i still think they should be in it but whatever
why name (what could be) anonymous functions?
the map looks right.
 
I name anonymous functions for readability
 
12:54 AM
@ThomasBlobaum how should error handling be done?
 
it deters readibility because i expect you'd use it again if you gonna take up that name space
 
if multiple iterators return an error by calling callback(err)
 
hold on, brb
 
Should the final callback pass a single err back or an array of errors?
 
0
Q: How much AJAX is too much?

CPhelpsMy current project is part of a highly linked architecture, with individual systems each owning certain pieces of data, and exposing them RESTfully. Both our web services and our user interface take advantage of this linkage, storing links to the resources in other systems rather than storing a c...

 
1:07 AM
back
an array of errors?
really?
 
@ThomasBlobaum ok consider this
after.forEach([fileName1, fileName2], function iterator(name, _, _, cb) {
  fs.readFile(name, cb);
}, function finished(err) {
  // imagine both reads failed
  // should `err` be a single error, an array of two errors or something else?
});
 
what does async.js do
 
dont know
 
an array?
might be good to see how its done in that module for an idea of what people expect
 
Ah no
it short circuits
 
1:13 AM
you could also throw a completely new error
hm
 
it returns the first error
in "random order"
async.js also has function iterator(value, cb) rather function iterator(value, index, set, cb)
The former is a lot nicer
 
shouldnt it just be (value, index, cb)
 
Array.prototype uses (value, index, array)
I cant think of a good forEach example thats async and works on an object :\
@ThomasBlobaum after.forEach
 
1:42 AM
How to add accessor properties to objects?
 
@Å imeVidas define "accessor property"
 
seems unnecessary to pass the collection or object in
 
you mean getters?
 
also i would call it .each
 
1:43 AM
@ThomasBlobaum it is indeed unnecessary but that's what Array.prototype.forEach does
@ThomasBlobaum I'll call it .forEach and alias .each
 
also the travis "recent" panel needs to die in a fire
 
agreed :P
it doesnt update :(
 
completely irrelevant distracting
 
The object literal notation has syntax for getters and setters:
get PropertyName ( ) { FunctionBody }
set PropertyName ( PropertySetParameterList ) { FunctionBody }
 
@Å imeVidas defineProperty
 
1:45 AM
But that's stupid :/
That's so unappealing..
 
Object.defineProperty(object, name, {
  get: function name() { body },
  set: function name() { body }
});
@Å imeVidas why is it stupid?
 
It's long...
It's much code...
 
then use dot notation and = is your getter and setter
 
@ThomasBlobaum That would be a data property, not an accessor property...
 
Guys, any good idea of profiling node.js code? v8-profiler module doesn't compile properly for me.
 
1:48 AM
unless you are building this into an existing framework i doubt it will be of any concern to anything
 
@Å imeVidas not really
 
@Raynos So to add data properties, one can just assign to obj.foo / obj['foo'], but to add accessor properties, one has to use Object.defineProperty(...).
 
How else would it be done?
 
I'm thinking...
 
If you want sugar then do something like
getset(obj, name, get, set);
That's about as good as it gets. @Å imeVidas your just complaining about a little verbosity.
@RubenTan use v8's profiler.
@RubenTan I use node --prof file and nprof
 
1:52 AM
@Raynos I can't seem to get --prof to work
it doesn't seem to output anything different from normal node
 
sure it does
 
node-profiler and v8-profiler were the first modules i tried
 
it creates a v8.log file
that's your profile data
 
you're talking about v8.log?
 
It's noise unless you process it.
 
1:54 AM
brb
 
Use ./nprof to process the v8.log file
 
you're talking about v8.log?
 
@Raynos If adding accessor properties to objects were a frequent task in a given script, one would certainly want to use sugar. And whenever you want sugar, that's an indicator that the standard isn't as usable as it could have been.
 
you're talking about v8.log?
 
why is it always people that dont even watch the project that open issues?
 
1:56 AM
@Å imeVidas I dont want sugar, you do
@RubenTan yes I am
@Å imeVidas and sugar exists it's called extend(o, { get foo() { ... }, set foo() { ... });
@ThomasBlobaum lulz :3
@Å imeVidas seriously though, what's wrong with property descriptors, I use them all the time and there's nothing wrong with them
 
lol, its all good i guess
 
2:15 AM
sorry, lousy connection here. thanks @Raynos, I'll try nprof in this case.
 
 
1 hour later…
3:28 AM
hm... anybody here? :S
tomorrow then :S
 
4:16 AM
RT @sgalineau: Ditching VML and filters in #ie10 http://blogs.msdn.com/b/ie/archive/2011/12/07/moving-to-standards-based-web-graphics-in-ie10.aspx Really. #ieblog
 
 
2 hours later…
6:08 AM
@Feeds /facepalm
 
.. and then you are surprised when people flag @Feeds
 
1 message moved to bin
They can't flag what they can't see :P
 
are you any good at IoC ?
i will take it as "no"
 
6:29 AM
posted on December 08, 2011 by Vasilis

Will the Browser Wars Invade the Mobile Web? I didn’t really understand this article. Does the author really want to go back to the IE6 days, but now on mobile? That’s a very strange and uninformed wish. There are also some very strange stats used: the author talks about mobile browsers but shows only stats for mobile operating systems. If you plan on reading this article (which y

 
 
1 hour later…
7:35 AM
Anyone know why this doesn't work?
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js"></script>
<script>
dojo.require('dojox.grid.DataGrid');
dojo.ready(function () {
    alert(dojox.grid.DataGrid);
});
</script>
It gives me a "cannot read property DataGrid of undefined" error...
 
 
2 hours later…
9:36 AM
hi all... i post this question stackoverflow.com/questions/8428739/… . Plz answer if any help me. Thank you.
 
0
Q: I can't to process response to a jsonp request

SashaI have url http://translate.google.ru/translate_a/t?client=x&text=enter text&sl=en&tl=pl If you will go through this link in response you will have js file with text: {"sentences":[{"trans":"wprowadzania tekstu","orig":"enter text","translit":"","src_translit":""}],"src":"en","serv...

2 messages moved to C#
@astrocybernaute: this room is for JavaScript chat. Please do not link to C# questions here.
 
sorry it was a mistake and i didnt know how to delete it
 
no harm done
 
10:05 AM
IE 10 finally removes support for VML and Transitions/Filters blogs.msdn.com/b/ie/archive/2011/12/07/…
5 messages moved to Casual chat
 
10:19 AM
RT @stoyanstefanov: Performance calendar day 7: @joshfraser of @torbit on automation of performance http://calendar.perfplanet.com/2011/automating-website-performance/
 
dont touch me easter eggs!
 
@ThomasBlobaum: they were JS related, and pretty cool.
 
hello
can you guys help me with a small problem?
 
negative
 
@ciprian you might want to get a doctor to look at that
it's outside my area of expertise
 
10:23 AM
only javascript here, brosef
 
:) it's JS
 
@raynos you sleeping
 
11:04 AM
RT @humphd: Hey, web, we made you Mouse Lock + Gamepad builds: http://vocamus.net/dave/?p=1388
 
11:35 AM
Hi there!
Looking for some help on this question of mine!
No complete answers yet :(
2
Q: Hiding Javascript When Building a Widget

MuratI am building a web widget which will be very easy to integrate. Say http://www.bicycleseller.com/ wants to integrate my widget on his web page. All he has to do is copy and paste the following to the head section of his page: <script src="http://www.widgetprovider.com/widget.js" type="text/j...

 
@Murat What does have to do with the question?
Also, you're loading jQuery, just to use $(window).load?
 
 
2 hours later…
1:11 PM
@YiJiang Same question has been asked a comment and my answer was: "The popup displays a JSP page. As one might propose a solution including JSP/Servlet/etc., I added the Java tag."
@YiJiang Yes, I load jQuery just to use that :) I lack a considerable amount of experience regarding UI/Front-end development, this is my first attempt at coding Javascript :) What would you suggest me to do instead of including jQuery?
 
Just use window.load = function() { ...
I mean, the code is simple enough in its current form to be written declaratively
 
@YiJiang Alright, thanks, will change to that.
@YiJiang I read that you are a well versed front-end developer :) Perhaps you could help me with the questions on my widget? I would appreciate that a lot :)
 
Not very, I work more with CSS and HTML. I'm a student, remember
 
Fair enough
Btw, I just found out that it's not "window.load" but "window.onload"
Thanks :)
 
1:29 PM
Ah crap, yes, onload. Silly me
 
New docs from @sheppy on Firefox support for audio & video URLs that specify a portion/range of the media to play https://developer.mozilla.org/en/Using_HTML5_audio_and_video#Specifying_playback_range
Facebook Developers HTML5 Blog http://developers.facebook.com/html5/blog/
 
1:51 PM
hey guys, how to get the size of a list in javascript? list.size() or list.size?
 
@user1010773: if you have an array, its just list.length
 
anyone wanna help me for a sec with GIT
specifically (without having to go though them one by one) is there a way to remove files on my public repo that are not on my local repo
 
@jAndy...thanks...
 
I'm for myself still a learner for git, however, I don't get the question
 
did you git rm them or just rm them?
 
1:57 PM
Wouldn't git add * and then push work?
 
(Or, I suppose, just delete them?)
 
actually git rm path/file.bar followed by a git push should do it
 
Just deleting is the same as rm, right?
 
Right
33 secs ago, by jAndy
actually git rm path/file.bar followed by a git push should do it
 
hrmm. I don't think i'm being understood. I have maybe 15 old files in a repo - I have re-factored the code and those files are no longer required So I have deleted them.
they were already pushed to the public repo before I deleted them.
so now locally in my libs folder say I have DB.php and SESS.php, and on my public repo I have DB.php, SESS.php and CONT.php
 
2:02 PM
What's worked for me earlier is just adding the entire local directory and then just pushing it. The removed files automatically leave.
 
I want a command (if one exists) that will basically check the files on my public repo against my local one and rm the files that don't exist locally from my public
 
Right. And if you git rm, they'll be removed from the latest version of your repo.
 
just git rm
 
@rlemon: if you removed those files locally, git does not push those removals to the remote repo (afaik) unless you remove those files also with git rm
 
But git rm is the correct solution, obviously
git rm CONT.php
 
2:03 PM
then it will apply the changes/removals on the next push
 
Hmmm... without going through them one by one, I'm not sure
 
yea - I was hoping there would be a flag to get er done
 
RT @ImYoric: In progress: JavaScript scheduling API.
 
Automatically Stage All Deleted Files (untested, but seems reasonable)
 
2:30 PM
@RyanKinal Why do you want to automatically stage deleted files?
 
I don't. @rlemon does.
Also, that was a very bot-like question
 
git add -u .
Automatically staging might lead to headaches down the road.
 
The page I linked was a single command, as far as I could tell. Not something that runs every time.
 
Also if you start using git on a large team (10+ people on one repo) it could lead to other annoying things.
Yeah but the -u flag already does it, why's he doing all this? :S
 
Obviously he was unaware of the -u flag :-)
 
2:35 PM
Oh nevermind he's using ls-files
> Only match <filepattern> against already tracked files in the index rather than the working tree. That means that it will never stage new files, but that it will stage modified new contents of tracked files and that it will remove files from the index if the corresponding files in the working tree have been removed.
-u is the above.
Pro Git is a good book, but it doesn't really cover all the side-cases
 
If you suspected someone was a robot (not necessarily bound by Asimov's Three Laws of Robotics, he has no trouble punching me), how can you test him?
 
If you want to learn how to do all the cool "big things" with git I'd read it, but then you need to find something else to flush out the rest of the knowledge, there's a bunch of stuff you can do with git that I don't really know about
@Zirak Ask it.
 
He'll deny it. If you were a robot plotting to kill me, would you just tell me that?
 
Why wouldn't the robot just tell you that?
Robots aren't bound to social mores and other human factors or need to belong to society.
If the robot wanted to kill you it'd likely just do so.
 
Because he's plotting to kill me. And if I'm aware of that, I can take action to circumvent that (like throw an MRI at him)
 
2:40 PM
Is it in the definition of "robot" that one isn't bound to social mores?
 
Can you overpower this robot?
 
I don't think we can take that for granted.
 
@RyanKinal "Robot" === "Humanoid creature constructed by humans, lacking emotions"
 
@RyanKinal No but "things" by default don't have such connections, they need to be specifically assigned. A blank machine intent on killing Zirak doesn't need to have such rules.
 
@Incognito I can't tell. It's usually a draw, but he can be strong yet act weak to delude me!
 
2:42 PM
Hypothetically, what about Artificial Intelligence?
 
@Zirak The robot would kill you right away.
@RyanKinal What about AI?
 
The suspect is showing ability to blend in society and delude others into thinking it has emotions.
 
Can we assume a robot with AI would not have emotion, and would not be bound by social contract?
I don't think we can.
 
I can always install a gigantic magnet outside his apartment and lure him out, to see what happens.
Unless he's made of biological tissue!
 
Of course, it might not be a robot at that point...
 
2:43 PM
Damn
 
@Zirak Why? This is a far more expensive way to kill you than simply doing so.
 
Killing me is obviously not his primary mission
I'm a pawn in a weird game of fleshy chess
It's time to consult Philip K Dick.
"Do Androids Dream of Electric Sheep" won't work. He won't let me test him.
 
Hi all. I was under the impression that this is a javascript discussion... Is it ok to aska quick js+mootools question in the hope that someone has confronted my problem before?
 
RT @reybango: Very cool to see that @qooxdoo has released v1.6 of their JavaScript framework http://bit.ly/vm7YdD offline, animations, a ...
 
Well, AI can be done in javascript, and robots are forms of AI, so this was a javascript discussion in a way
 
2:51 PM
hoy
 
Granted. I'm afraid my problem is not AI-related
 
hey guys, does anybody knows how much parameters can be sent to a new pop up window created by js with window.open function?
is there any limitation ?
i have this code
 
This is the JavaScript room. But a group of intelligent people will often take part in conversational diversions. Because we get bored of one subject.
 
var url = 'someurl';
var options = "window options";

newWindow = window.open(url, "_blank", options);
newWindow.param1= param1;
newWindow.dateStarted = date;
newWindow.timeStarted = time;
 
@RyanKinal Define "intelligent" :P
 
2:54 PM
etc
 
@Vlad why don't you encode your options as JSON string, then decode them in the popup?
 
@Vlad newWindow.thingy is just javascript variables, so technically no limit. I can't recall what options serves as, and url suffers from the same length-restriction as any url (though if you meet it, you're probably doing it wrong)
 
@ValRedchenko You can ask whatever you want. I don't think many people in here use Mootools, though.
 
@ValRedchenko Why haven't you asked your question yet?
 
Right. So my problem is like so:

elCHBX = new Element('input').injectInside(elTD2);
elCHBX.setAttribute('type','checkbox');
errors on second line in ie8 and 7
(have not tried 6, but works fine in 9)
 
2:57 PM
@Zirak I am having trouble to send 13 to 15-th parameter to the new window so I am suspicious about having some limitation
 
@Vlad try encoding your params as JSON as a workaround
 
@ValRedchenko goo idea
 
Hi there
 
good
 
Looking for help. Any comments/suggestion appreciated :)
2
Q: Hiding Javascript When Building a Widget

MuratI am building a web widget which will be very easy to integrate. Say http://www.bicycleseller.com/ wants to integrate my widget on his web page. All he has to do is copy and paste the following to the head section of his page: <script src="http://www.widgetprovider.com/widget.js" type="text/j...

 
2:58 PM
@Vlad beware that some older browsers never implemented json - there is a library on github that emulates that functionality
 
@ValRedchenko I can't see an element.injectInside method in the mootools api
 
They suffer from the jQuery disease of attributes are properties.
 
Does MooTools extend native objects?
 
@Incognito Sorry forgot to mention - I'm locked into using mootools v1.1
@RyanKinal I believe so
 
In that case, I would guess that IE7 and 8 don't implement setAttribute
And neither does MooTools
 
3:01 PM
any ideas why this isn't working? jsfiddle.net/eYg5r
 
@ValRedchenko Try this:
elCHBX = new Element('input', {'type': 'checkbox'}).injectInside(elTD2);
 
since json is not available on all browser than I guess other solution, maybe js array of parameters
 
@ValRedchenko Probably a mootools error. I don't use moo enough to know it's quirks. I would suggest using regular JS to solve your edge-cases that moo gives errors with.
 
@RyanKinal That's another problem with mootools1.1 + IE - it barks at that syntax in the second parameter
 
3:04 PM
@ValRedchenko Huh. Strange indeed.
@Incognito probably has the right of it
 
@RyanKinal Well - I guess I'll just have to tinker with it. @Incognito i'll be exploring that avenue, thanks all
 
@ValRedchenko Most of the people in here like to use JS-only, very small libraries, or have some knowledge of larger ones like jQuery and systems such as Node.js.
 
@ValRedchenko No problem. Sorry we weren't more help :-)
 
If you come back later other people will be in here, might be a better chance to get your answer.
Or just post the question on the site.
 
3:06 PM
I kind of want to learn Prototype and MooTools, just so I can help people more effectively
 
Maybe even screw around with all the libs available on jsFiddle. Although, that's quite a few.
 
@rlemon Thanks
 
@RyanKinal jQuery, underscore and backbone seem to be the way forward with all the cool kids as of late. I'm only using moo 'cos Joomla locks me into it (and my boss locks me into Joomla)
 
what was up with the $.each() method?
 
3:07 PM
anyone going to mention json.js, json.org/js.html? Thats what I use in browsers that don't have native implementations.
 
@ValRedchenko Hah, fair enough
 
you were not using it correctly I would assume.
 
yes i assumed that also
my wonder was how
 
@Loktar I think @ValRedchenko mentioned it, via github
 
3:08 PM
ah ok good :P
I should of read up more sry :?
 
@FrankAstin correction, in the $.each() this refers to the String object
I think the issue was somewhere else - i'm looking right now.
also your setTimeout the parameter passed is not correct.
it works because said variable is in the scope
jsfiddle.net/eYg5r/4 <- two problems that were in your original code.. (aside from never using var)
 
@rlemon cheers ,
 
Anyone familiar with DNS configurations?
I'm looking to set up a four-level DNS name.
four.bar.example.com
 
@FrankAstin I suggest you look into some basic js stuff. not only is JQuery going to promote bad habbits* but I am seeing some pretty basic bugs in your code that you will need to correct regardless of using jQuery or not.
 
Except four gets to be like an *.bar.example.com
 
3:15 PM
@rlemon yes , I'm reading "the definitive guide" at mo the moment
 
@FrankAstin javascript.info read that.
 
@FrankAstin tl;dr - Javascript: The Good Parts
 
As far as JSON implementations, it seems json2.js uses "eval (guarded with several regular expressions)". Should we avoid this due to the evil that is eval? Or is it considered a "safe" use?
 
@Incognito thanks
 
@RyanKinal I'd avoid it, sometimes eval is put in for strange reasons.
 
3:17 PM
@rlemon I'll add it to my wish list , got a few books that I need to get first ,
 
@RyanKinal There was a discussion about this on stackoverflow questions somewhere. If I recall correctly, eval may be evil but is a hell of a lot more memory-efficient than writing a json-parsing library based on string manipulation
 
@FrankAstin The definitive guide is good - if you want to spend the time to read through all 1000+ pages.
I keep it on the shelf for reference.
Javascript: The Good Parts was defiantly a better read.
 
See, that was kind of my thought. eval seems like it would be much more efficient, but the recursive descent version (json_parse.js) would be safer.
Not that it matters in modern browsers.
 
@rlemon yeah i could with something more light , good coding practices ect
 
elm.innerHTML = ""; ohh how I am so tempted to use you right now...
 
3:19 PM
@ValRedchenko thanks
 
@RyanKinal np. more about JSON and eval here: stackoverflow.com/questions/1843343/json-parse-vs-eval
 
@rlemon cheers
 
Dude... is caniuse - JSON accurate? Is JSON really implemented in all current browsers?
Is json2.js obsolete?
 
@RyanKinal in all current ones - yes. but json2.js is about as obsolete as IE6
 
3:22 PM
@RyanKinal I think it's basically a crutch for legacy browsers.
 
IE8+ is good enough for me. Screw IE6.
I mean, there's still 7... but whatevs
 
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
I see.
 
hi i would like to split the list [Acer, HTC, Motorola, Samsung, SonyEricsson]..i used split(','), but its adding '[' along with acer and sonyericsson...
any hints?
 
.... what?
Is that a string?
 
Looks like JSON to me :-D
 
3:26 PM
Remove the quotes on the outside, put the quotes on the strings in that array.
 
hmmm, let me try...thanks
 
If you're going to support IE 6, does that mean you should support Safari 1 also? IE 6 was released in 2001, Safari 1 in 2003...
 
@AndyE User %.
 
@Incognito yeah, but IE 6 % should be fairly low these days, amiright?
 
"should be" !== "is"
 
3:28 PM
8.9% globally
 
@FrankAstin Just always remember when your considering using jQuery - Minified it's still ~100kb. Do you really need all of that overhead just so you don't have to write a few getElementById's
 
tbh, I gracefully degrade for IE 6, but I don't make any effort to make features on my site compatible with IE 7 and lower.
 
(including botnetslolz)
 
RT @erikdahlstrom: twitter riots, an interactive webapp using web graphics (#svg, #canvas, #webgl) - http://www.guardian.co.uk/news/datablog/2011/dec/08/twitter-riots-interactive
 
@AndyE It's not about release year, it's about usage. IE6 came by default with XP, and you average WinXP user will often not bother upgrading. Safari 1 users, as a rule, are a hell of a lot more computer-literate. P.S. and Apple have done well to force upgrades on their users, unlike MS
 
3:57 PM
@rlemon absolutely!
 
@jayp facepalm
 

« first day (418 days earlier)      last day (4524 days later) »