« first day (405 days earlier)      last day (4543 days later) » 

3:17 PM
Anywhere I can browse gecko's code base online?
 
@YiJiang I can't just link like this with webkit?
 
Its not exactly user friendly, but its the only way I think
I think you can, lemme see
 
@Incognito brave :)
 
So, I come and ask again, crying for help
Oh, please, somebody please, help me
0
Q: Google map showing gray areas when show / hidden

ÓscarI'm having this problem: I have two Google maps in one page, showing just one a time. One shows a user-selected preferred store. If the user wants to choose another one, a WebService provides the nearest ones, and with that info, I hide the first map (and some associated elements), create another...

 
@Incognito you will get shitloads of flame for that blasphemy
 
@tereško someone had to say it though :)
 
@tereško That's why my name was foobar and my email was @example.com
 
and woo js weekly mention \o/
 
3:37 PM
I must be blind, I can't see your bit in jsweekly.
 
:(
Its the improving ES5 oo
because I have no RSS I dont get a proper excerpt
 
Eh, the blog is kinda rudimentary. You've got sessions set up, why should I still see the edit and delete buttons?
 
Internet is making me nerd-rage like a machine, I'll be back another time. Can't deal with.
@YiJiang He's re-writing it i think.
 
@YiJiang because im fixing it
Ugh what should I work on
DOM-shim or my blog?
 
jesus, I never get mentioned in that sucking javascript weekly mail :p
 
3:50 PM
@Raynos Cute... and pointless :P I like it
 
@jAndy why u no link whore on hacker news?
Whenever I link whore on hacker news I get mentioned on js weekly
 
@Raynos Ahahahaha :P So that's your secret
 
@jAndy also your blog is a rotating sphere -.-
 
thats just my playground :p
 
Wheres the blog?
 
3:52 PM
typeofnan.blogspot.com is zeee blog
 
Oh, and remind me again, never use cursive as a fallback font stack option, because that defaults to Comic Sans on most machines D:
 
but www.typeofnan.com is worth a visit nontheless :p css3d is OHSOCOOL
actually the plan was to create a little example app which uses BarFoos as framework (all the loosely coupled stuff and techniques)
but again I ran out of time, so its just a rotating black box right now ^^
 
@YiJiang D:
 
@Raynos I realized that after getting exposed to a dose of it after Google Fonts somehow failed to load for your site the first time I visited it
 
Ok so Ill work on my blog today
it is decided
 
3:57 PM
no words for the rotating box :( hey, its css with js only, not even webgl
do only I think this is ridiculous awesome ?
 
@jAndy Eh, Mozilla had that demo for quite a while now
They even threw in some videos on the box surface
 
@YiJiang: that would be surprising since firefox does not even support css perspective
@YiJiang: I guess that was webgl too
 
Its not rotation, but I don't think it would be hard to get it moving
 
it is
its just skewed
not z-angle at all
 
@jAndy jawesome
Wait what
you used js ? cheater
use CSS3
 
4:10 PM
yea you could do that with css only (anim frames), but I have big plans where I need some more dynamic
 
4:37 PM
Hey... Does anybody know how to mdoify js variables by reference?
0
Q: Initialize variable by passing a reference on a function

ÓscarI'm wondering how could you initialize a variable by passing it as a reference on a function. Here is the code: var carToy, trainToy; function setToyValue(name, description, toy) { toy = new makeToy(name, description); } function makeToy(name, description) { this.name = name; this....

 
user1385191
lol, are the jQ people seriously contemplating "removing" IE 6-8 support?
 
@MattMcDonald it makes sense to put IE8 support in a seperate bundle
im doing that with DOM-shim
Ill have one file for modern browsers and one for legacy engines
 
user1385191
this is a big fallacy in browser scripting
 
user1385191
pinpointing "versions"
 
user1385191
pinpoint implementations
 
4:45 PM
@MattMcDonald thats basically what zepto is
@MattMcDonald not really :\
I'm simply shimming only the features that need to be shimmed
I'm then giving you a fatter shim that shims more features
Its basically removing code cruft
browser detection is bad. having a seperate bundle that does more browser support isnt bad
 
4:59 PM
hey peeps
Raynos & all
Im confused about something
the variable bracketing in jquery & its implications on javascript code
as an example: Im using jquery on variable to do a bit of manipulation
then when I try to use normal js on that variable, I get 'undefined'
actually, at someplaces I do, and at some, I dont
which is all the more confusing
 
...
jQuery shouldnt corrupt variables you put into it
most likely your doing it wrong
Tip 1: dont use jQuery
Tip 2: show example code
 
right
so here is what I am doing:
$(document.createElement('div')).addClass("cCreditTransaction")
... a bit more jquery follows...
and then I have this line:
creditTransactionSlideOut (eCreditTransactions[i], 666);
i.e. a normal javascript function being called
 
What is eCreditTransactions
what is i
 
1st is an array
i is a member of array
so at the top I have defined eCreditTransactions as:
var eCreditTransactions = new Array(6);
now at the point where I wrote:
creditTransactionSlideOut (eCreditTransactions[i], 666);
if I do console.log(eCreditTransactions[i]);
firebug lets me know that its a div inside jquery container
now in the next line:
I have this small function:
$(eCreditTransactions[i]).on ('click', function () // if user clicks on the transaction box
{
console.log(eCreditTransactions[i]);
creditTransactionSlideBackIn (eCreditTransactions[i], 150);
console.log('bye')
});
i.e. attaching a 'click' event
to eCreditTRansactions[i]
but this is where things go wrong
console is telling me that the following is undefined in this function
$(eCreditTransactions[i])
(the bit before the .on method)
how come?
 
@Kayote -.-
i is function scope not blocked scope
for (var i = 0; i < 10; i++) {
  setTimeout(function () {
    console.log(i);
  }, 50);
}
 
5:12 PM
O_o
 
Try it.
 
Hi. Does Firefox not support websockets? html5demos.com/web-socket
 
@JoeyMorani depends, do you run firefox 3.6?
 
Won't work :S
No
8.1 I think
 
user1385191
I smell functions in a loop
 
user1385191
5:13 PM
yummy
 
8.0.1
sorry
 
@JoeyMorani probably just bad code on that page
In firefox it's MozWebsocket instead of WebSocket
 
Ah okay. So it supports them then? :)
Ahh
Ok
 
so it does support it but the code only checks WebSocket
 
Ah righty. Thanks :)
 
5:14 PM
// let's invite Firefox to the party.
if (window.MozWebSocket) {
  window.WebSocket = window.MozWebSocket;
}
That page should work
 
Raynos, Im not sure what the point is
what do you mean by block scope?
 
user1385191
uh oh
 
Matt... o_o
you are not trying to freak me out are you
 
user1385191
 
@Kayote functions in a loop are probably the number one cause of issues for JS newbies. developer.mozilla.org/en/JavaScript/Guide/…
 
5:24 PM
I can relate to that
 
user1385191
ignore the closure solution
 
yea
 
user1385191
pass the array element to a helper method
 
it seems to make it more complicated than we newbies can handle
 
user1385191
function helper (element)
{
	//do something
}

function iterate (something)
{
	var i = 0,
	limit = something.length;
	for (i;i<limit;i++)
	{
		helper(something[i]);
	}
}
 
user1385191
5:26 PM
nothing complicated about that at all
 
actually, I dont have a loop going on
in a nutshell, when a user clicks a button;
a member of an array (eCreditTransactions) is filled with divs using innerHTML
 
perusing thinkgeek/haiku got me thinking...
two ideas eternally divided
nerd rage within
support, IE
and with that! lunch!
 
the variable (eCreditTransactions[i]) is just one member of an array
to which I then attach a 'click' event using jquery .on
however, my confusion is about how jquery handles the javascript variables
and how I can apply normal javascript to that variable which is in jquery brackets now
am posting to jsfiddle
 
user1385191
if confused when using jQuery, drop jQuery and prosper
 
easy for you to say Matt, jquery really makes life sooo much easy
its almost like cheating
:)
 
user1385191
5:31 PM
paste your code
 
though there apparently is an art to cheating as well
a moment
 
Cheating only works when you already know the answers
 
@Kayote your attaching the event handler in a loop
the event handler is a function
thus your making a function in a loop
Did the penny drop yet?
 
@OriginalSyn or know someone who does...
 
Have a look at this:
Raynos, where is the loop in there
 
5:38 PM
...
You's trolling
 
also, as a side note
 
user1385191
oh boy
 
guys, please give me
suggestion on my formatting
 
user1385191
/* ***** THE PROBLEM AREA BELOW ***** */
 
user1385191
no, the problem area is the entirety of the code
 
5:39 PM
I get a lot of fuss over the formatting of my code, is it really that bad?
lol
 
user1385191
you have tons of useless comments
 
user1385191
read it
 
yes, the comments are in case
you know what they say about more and more commenting
 
@rlemon lemme rephrase, cheating only works, long term, when you already know the answers
 
5:42 PM
@OriginalSyn ahhh, ok..
 
by the way, I read on stackoverflow that writing:

eCreditTransactions[i] = undefined;

doesn't actually make the variable undefined, is that true?
 
user1385191
if your approach is to reuse the same array elements, it's fine
 
user1385191
what's meant is the array element will still exist
 
thanks Matt
yes, however the content of the array element will be removed, right?
 
user1385191
>>> var foo = [1, 2, 3];
undefined
>>> foo[0] = undefined;
undefined
>>> foo
Array [undefined, 2, 3]
 
5:48 PM
@MattMcDonald what is the benefit of this - i'm looking at the code and I don't see why it is needed in this case.
 
user1385191
the intent is to reuse the same elements
 
seems to me that additional error checking may be required to tell if the value is empty or does not exist.
 
user1385191
like using the same table cells in the DOM
 
user1385191
more performant
 
@MattMcDonald ok - that was just an unneeded example the OP provided??
ahh well. i give up - i'm not looking at any more $
 
5:50 PM
I see your point rlemon
as I am using '.remove' as well
is it 'members' inside an array
 
.remove() is just removing the associated elements from the dom
 
or 'elements' inside an array?
 
tomato tomAto
 
trying to get my terminology right
 
user1385191
the biggest problem with your code is what I call "variable phobia"
 
user1385191
5:53 PM
you're seemingly scared of using variables
 
user1385191
resorting to dreck like magic.spell().cast().end().of().turn;
 
@Kayote then arrays have key/value pairs - not elements or memebers.
 
@Matt
I took that as a recommendation after looking at so much code on SO
 
user1385191
sigh
 
people tend to use that a lot
 
user1385191
5:55 PM
I have a personal limit of around 3 levels of "chaining"
 
point noted
 
user1385191
ie: "foobar".replace("foo", "").slice(0);
 
thanks @rlemon, thats what I need to use, keys & values
 
user1385191
magic.spell();
magic.cast();
magic.end();
magic.of();
magic.turn;
 
guys, whats going on here:
var helpText = [
{'id': 'email', 'help': 'Your e-mail address'},
{'id': 'name', 'help': 'Your full name'},
{'id': 'age', 'help': 'Your age (you must be over 16)'}
];
I know its an array
but whats with the multiple {}
or is that creating objects (I dont think so)
 
5:58 PM
It's an array of objects
typeof helpText[0]; //"object"
 
cheers
 
user1385191
"object"*
 
user1385191
typeof returns a lowercase string
 
That's what I was correcting
 
everything is an object in javascript
 
6:01 PM
True for arrays, as far as I know
What else?
ES5 allows Array.isArray(); to fix arrays being objects
 
...
 
@Raynos Your ellipsis scare me
 
Raynos, Matt
any more suggestions on my code?
re formatting
and the jquery/ javascript variable issue
 
Bin it and write it again?
 
user1385191
^^^
 
6:08 PM
and what is it that I would change?
 
not use jQuery ?
 
actually you guys haven't seen the real problem area :D
 
Writing modular code?
 
this is as modular as I have ever been
there are like 8 functions in my small script
which is not bad
Im quite confused by the jquery/ js issue
and google/ SO searches dont bring up much of relevance
 
6:24 PM
In ES6, what would this do?
array.push(thing1, thing2, ...moarThings);
 
apologies, there was a major problem in the code
now its much better
 
user1385191
why use push when you can use concat?
 
user1385191
[].concat([1, 2, 3]);
 
sometimes things are harder to see
 
6:41 PM
 
user1385191
invalid fragment
 
@Incognito :D
 
So, there goes the next few months of my life: dwavesys.com/en/dev-tutorial-intro.html
 
thats cool
 
I just realized you can close the "welcome to github" banner
I've had it up there since I opened the account.
This site is actually clean now.
Damn..
 
6:50 PM
<div>
    <p> ... </p>
</div>
div.childNodes[1].tagName === "P"
Is the first childNode a Text node or not?
 
user1385191
I'd say it's a text node
 
user1385191
note the tab character as well
 
a text node
 
[0] would be the first?
 
@MattMcDonald the tab character is a second text node?
[0] is the first, I believe <p> is [1]
Its a pain to think in text nodes.
I prefer el.children and el.firstElementChild
 
user1385191
6:54 PM
go to jsbin
 
user1385191
check the body's childNodes with the default configuration (minus JS)
 
user1385191
it's a newline + spaces
 
Your right, thanks
do those text nodes bug out in IE?
 
user1385191
in what way?
 
@Incognito I made that discovery as soon as I actually read and dismissed the donation plea from wikipedia.
 
6:56 PM
Interesting
 
I generally ignore all header bars
 
When unit testing how do i fake a logged in user / session ?
 
user1385191
create a dummy session?
 
user1385191
(not sure about node)
 
a dummy session is basically a cookie
and session set up oon the server
 
7:03 PM
@Raynos How are you testing? Curl?
 
@Incognito request
Turns out it has cookie support baked in
 
request "method" doesn't mean it's an object "method"
Hate http abuse.
 
?
What do you mean?
 
Ranting.
 
user1385191
blech
 
7:14 PM
@Raynos I'd just use curl/wget or something else.
 
user1385191
there's that comma-at-the-beginning-of-a-line-to-indicate-a-continuation-of-variable-declaration style again
 
user1385191
makes me nauseous reading it
 
[ u
  ,mad
  ,bro
  ,?
]
 
@Incognito no seriously whats the problem with requests api?
@MattMcDonald blame isaacs
 
@MattMcDonald I think that's an enterprise thing.
 
7:15 PM
@Raynos Same reason I don't like jQuery's .get and .post.
 
user1385191
it's the opposite of enterprise
 
The request method is a format
 
@Incognito Oh you object to request.get ?
I don't use it.
What's wrong with having utilities for common methods?
 
It's api noise.
It adds complexity to your code for no reason.
 
7:17 PM
@MattMcDonald the comma first style was made for a good reason
@Incognito I don't see how having those there is noise :\
 
user1385191
imagine reading a book
 
user1385191
instead of seeing a hyphen at the end of a line to imply continuation, it's at the beginning of the next line
 
user1385191
wouldn't that throw you off?
 
@MattMcDonald its a style preference that takes getting used to
However it's useful for debugging
@Incognito
// verbose
request({
  method: "PUT",
  uri: url
}, cb);
// jawesome
request.put(url, cb);
 
@MattMcDonald no I mean from enterprise-js.com
 
7:19 PM
@Nathan nop, its isaacs style code, common in the node community
 
I've seen it mostly in enterprise SQL. One benefit is being able to easily comment out a single line without leaving a trailing comma.
@Raynos it's certainly not new with Node.
 
user1385191
And so, the ambitious young fox leaped over the painted fence and into the stratosphere, eclipsing the position of the leth-
argic dog

And so, the ambitious young fox leaped over the painted fence and into the stratosphere, eclipsing the position of the leth
-argic dog
 
@Nathan I meant in the javascript community that coding style has been made popular by isaacs
 
whoah I'm out of practice keyboard with the shortcuts here.
I'm flailing all over
imho, only comment lines and quotes should start with punctuation.
 
7:34 PM
2
Q: How to become an expert in Python, PHP and Javascript?

So I've been programming for about 9ish months now, and I've taught myself some Python, some PHP and some Javascript. I want to become better at these languages - I can hack something out, but a lot of things like OOP, using lists in the most effective ways, etc, is lost on me. What are the bes...

 
user1385191
lol
 
user1385191
"Q: How to become the supreme overlord of the universe?"
 
I'm trying to understand the lexical grammar... Why do there have to be two goal symbols - InputElementDiv and InputElementRegExp? Why on just InputElement?
 
@ŠimeVidas context.
 
Can't the lexer figure out what the context is...
 
7:47 PM
Hey. Anyone know what this means?
Error in event handler for 'undefined': TypeError: Cannot read property 'hasPort' of undefined
    at WebSocket.onopen
In chrome
 
@ŠimeVidas I mean link to definition of inputElementDiv etc
you asked a question assuming I have the same spec your reading open
 
Well, the ECMAScript spec... 5.1
 
@JoeyMorani it means that the obj your calling hasPort on i undefined
 
I'm reading @ es5.github.com
 
@ŠimeVidas It'd be ambiguous: is (a) a reference to the variable a or a regexp?
@ŠimeVidas Which has an affect for what lexical items are valid in each context
 
7:48 PM
I'm using websockets:
if (window.WebSocket) {
        var ws = new WebSocket('ws://77.101.97.204:8181/demo');
    }

    ws.onopen = function() {
        alert('Handshake successfully established. Ready for data...');
    };

    ws.onmessage = function (e) {
        alert('Got WebSockets message: ' + e.data);
    }

    ws.onclose = function() {
        alert('Connection closed.');
    };
This is what's causing that error.
 
@JoeyMorani Consider the case where window.WebSocket is falsey
 
Yeah, also done that. But didn't include it in that code :)
 
@JoeyMorani You have ws = undefined effectively
 
Oh
I also have:
if (window.MozWebSocket) {
  		var ws = new MozWebSocket('ws://77.101.97.204:8181/demo');
	}
 
@JoeyMorani And then you try and do ws.onopen = …, and you can't set a property on undefined
 
7:51 PM
Ahh
But in Chrome shouldn't "window.WebSocket" be true ?
 
@gsnedders I think I understand now ...`
@gsnedders So the lexer has to keep track of the context at all times and execute the correct goal symbol - either InputElementDiv or InputElementRegExp...
What a mess... :/
 
@ŠimeVidas :(
 
Context is needed in everything but, well, context-free grammars. And not that many major languages have context-free grammars.
 
0
Q: Javascript detect when inner html has changed

JohnI have tried attaching the even onchange and change(with jquery) to an element that updates every couple seconds. Neither of these events are raised when the inner html is changed. How can I detect with with javascript or jquery?

 
@gsnedders I thought the grammars defined in ECMAScript are context-free grammars.... ?
 

« first day (405 days earlier)      last day (4543 days later) »