« first day (601 days earlier)      last day (4350 days later) » 

hhh
12:14 AM
Q1. What is a good database that has good JSON -support so that you can transfer data easily to Javascript application? MongoDB or something else?
 
hhh
12:28 AM
Q2. What does `"good JSON support in DB"` mean?
Q3. Does it mean `"good Javascript-object -management"` or just the JSON -format or both?
 
 
2 hours later…
2:41 AM
Good Morning guys
Have a nice day (y)
 
2:59 AM
evening folks
 
3:13 AM
Along with Opera, Firefox Nightly now has Microdata DOM API support. How-to: http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#using-the-microdata-dom-api Tests: http://w3c-test.org/html/tests/submission/Opera/microdata/001.html
 
3:26 AM
good morning all
 
how do you stop the # from appearing in your browser url with "onclick" events in href's ?
its bugging me alot now
 
3:42 AM
@dave, return false
 
i do
still doesn't work
 
something wrong in your code then
 
for example:

<a href="#" onclick="return function_name()">Test</a>
function function_name(){
return false;
}
i get the #
 
remove that return from the onclick
 
ok i'll try
 
3:45 AM
because now it returns a function and not false
 
index.php#
lol :P
still did it
 
hum
something wrong in your page maybe
look at the console
is there any js errors?
something else is breaking the page I guess
 
your's works because it don't work
Uncaught ReferenceError: test is not defined
 
guys what is the cleanest way to do rectangle hit detection for 2 value cursor
 
a bacon sandwich ?
yay fixed the hash
so why did you just post a C# question in a JavaScript chat room - no wonder you're stuck. @user167908
@user167908 im reporting you - you posted that in all the damn chat rooms
 
4:29 AM
@Dave I reported him from C# chat.
for spam
 
 
2 hours later…
6:47 AM
@rlemon diablo has a mac version /o/
@Abhishek o/
@TomShreds o/
 
hi @Esailija :)
how are you doing?
 
fine :P
 
-2
Q: How to change javascript code to Jquery?

user1427625I need to convert this javascript code to Jquery? eval("document.forms[0].strKey" + intDimId).value + "," + tarr[i]; Can you please help me how to change the above code to jQuery Thanks, Rajasekhar.

eval for this?
oh @Esailija, you're over 14k now! :p
 
^^
 
7:02 AM
hm
index() in jquery starts at 0?
 
yea
 
0
A: Adding class as per LI postion

Florian MargainePlay with the modulo operator, it's fun! $( 'li' ).each( function() { if ( $( this ).index() % 1 === 0 || $( this ).index() % 3 === 0 ) { $( this ).addClass( 'light' ); } } );

not sure if it's correct, but it's fun :p
 
function index(node) {
	var parent = node.parentNode,
		elem, i = 0;
	if( !parent ) {
		return 0;
	}

	elem = parent.firstChild;

	while( elem ) {
		if( elem.nodeType !== 1 ) {
			elem = elem.nextSibling;
			continue;
		}

		if( elem === node ) {
			return i;
		}

		i++;
		elem = elem.nextSibling;
	}

	return i;
}
btw, while making the css selector engine
I found out that I pretty much need to run this function for all elements in the set for nth-child selectors
lesson = nth-child is fucking terrible selector
 
@FlorianMargaine: integerValue % 1 === 0? Come on ;)
 
:D
 
7:07 AM
hmm
yeah, gotta change that :D
 
@Esailija I might be mistaken, but if (node.parentNode) won't work in IE.
 
what?
 
@FlorianMargaine: Try integerValue % 3 === 0 || integerValue % 3 === 1.
 
we talking IE3 here?
 
7:08 AM
Nope, 7 or 8
 
@Zeta %3 === 0 & %4 === 0 isn't good enough?
feel free to edit btw, I'm not the best in maths :p
 
>> var a = document.createElement("input")
>> document.body.appendChild(a)
>> !!a.parentNode
true
in ie6+
 
parent.Node of unAppended node is a fragment with nodeType 11
Might be just a problem with my code though...
let's say you don' append.
 
> !!document.createElement("input").parentNode
false
 
And do a check for parentNode.
 
7:10 AM
@FlorianMargaine: This would result in the following pattern: 1001101011 :D
 
oh
well, I'll trust you then
 
well don't run with your code then
 
btw
is it worth it to cache the object there? stackoverflow.com/a/10944402/851498
I'm remaking a call to jquery everytime, so let's say it is
(heh, I answer my own questions when I ask them)
 
lol you are making call to index
twice
did you just not see how expensive it is
you can't even cache dom because dommutation events are unreliable or deprecated
so you have to calculate it every time
DUDE
$(this) is cheap as fuck
.index() is expensive
LOL
 
ok :p
I edited don't worry
@Esailija what I thought, just not sure
 
7:14 AM
var a = document.createElement('div');
var b = document.createElement('div');
a.appendChild(b);
if (a.parentNode) {
    console.log('A has parent with type: ', a.parentNode.nodeType);
}
 
ok but in this case there is a tree so it won't affect my code
but interesting to know nevertheless
 
Yeah I see - your life is too short to wait 13ms for the DOM parsing to work. - trow one quote or linefeed into the var and your browser will puke — mplungjan 7 mins ago
hahaha
 
IE7 and IE8 both behave the same way
I just fell in that pit yesterday and couldn't figure it out...
 
7:29 AM
@FlorianMargaine what the fuck is that guy smoking
 
^^
0
Q: How to show a popup with textbox and browse button in javascript?

SaravananIn my asp page, i want to show a popup window whenever user clicks the button.The popup window contains one text box and submit button for getting the filepath from the user. for example : i want a popup like this in stackoverflow site... Please hele me to get this...

god, the answers suck
 
I am curious to know why you would think a quote or linefeed would somehow be different from any other character in a string performance wise. — Esailija 6 secs ago
 
even the 34k rep guy answered stupidly
@Esailija totally :D
> If you can be sure there are no linefeeds or quotes in the text, you do not need to use the DOM but can use a string directly.
why is that btw?
what about linefeeds or quotes that's so wrong?
 
I just asked about that
read the comments
 
his comment is stupid :/
 
7:40 AM
6k to trusted member\o
 
what can do trusted member?
lots of shit, right?
 
ban all the users
 
Can they ban themselves?
 
my god, with every comment he makes, he makes even less sense
 
@Esailija he deleted his answer
what was his last comment?
 
7:47 AM
oh
Why is that off topic? The main reason for NOT using a var is that. there are no reasonable limitations to the size of a var that I know of – mplungjan 1 min ago
needed to copypaste directly :D
 
I don't understand what he means :/
mplungjan, Netherlands
14.4k 2 14 29
 
raynos is from netherlands too
 
> In the time I have been here, I have enjoyed gaining enough rep to help edit question and would be happy to give more assistance since that is what I like to do in general, help people.
 
:D?
 
good guy mplungjan /o/
 
7:48 AM
I see a connection
 
rofl @Esailija
raynos, although trolling, knows his stuff
 
yeah I kid of course :D
 
7
Q: Download File Using Javascript/jQuery

MithunI have a very similar requirement specified here http://stackoverflow.com/questions/1296085/download-file-using-jquery need to start download a file when i manually calls $('a#someID').click(); But I cannot use window.href method as solution since it replaces the current page contents with the ...

17k views, and the accepted upvoted 19 times answer sucks
 
why couldn't he just document.location = url
if the url has download it will jsut popup it
 
exactly...
3 mins ago, by Florian Margaine
17k views, and the accepted upvoted 19 times answer sucks
 
7:55 AM
RT @versatica: SIP over websockets spec: http://tools.ietf.org/html/draft-ietf-sipcore-sip-websocket-00
 
uh, seriously
browser is the only thing needed
@Esailija remember node-fluent-ffmpeg not being asynchronous? github.com/schaermu/node-fluent-ffmpeg/issues/…
 
heh
 
8:24 AM
hey all
was wondering if it is possible to load a website inside a div.. will changing the target do the thing or does it have to have a little javascript here and there?
 
indexOf is actually slower than a for loop... pfff
 
@Oleg context?
 
I wanted to design a browser (sort of) in a div.. just give it the look and feel of a browser.. go back pages.. load additional pages.. etc
 
@ShyamK you can place an iframe with the site in a div
 
@Oleg uh. 9M op/s vs 12M op/s, use indexOf -_-
 
8:28 AM
@Oleg iframe? again? will this give the x-frame errors that I was getting when I tried to load a map into an iffame? I don't wanna go through that again. What exactly is an iframe used for?
 
you know, forEach is slower than a for loop too
 
@ShyamK uh... to load external sites into a page
@FlorianMargaine No IE support. Will have to redefine indexOf >_>
 
by the way.. I solved that map issue.. changed the iframe to a div and used the bing api to load the map into it
 
shim it, it's easy
mdn provides the shims
 
@FlorianMargaine Thanks for the help the last time. :)
 
8:31 AM
doesn't look like it helped you though
 
:D
 
0
Q: Better way to do this

freebirdI am having a popup ,which is styled to match the page,I am using that single popup to display messages to the user.My popup contains one h1 element and an Asp.Net Label , the h1 element and Label contents and color changes according to the operation , if the information was successfully inserte...

 
I was just hoping that indexOf had some magic that would execute an Array search faster than a traditional loop.
 
@FlorianMargaine advice of any kind is a help.. its a learning experience.. so I thank you for your advice :D
 
\o all
 
8:32 AM
o/
 
8:43 AM
(>_<) MDN's workaround for indexOf is 91% slower...
 
document.getElementsByTagName('a')
NodeList[148]
document.links
HTMLCollection[130]
it's not a workaround, it's a shim
what's the real difference between NodeList and HTMLCollection?
 
Let it be shim.
 
8:56 AM
htmlcollection has elements .P
I don't know lol
did you know that without caching in implementation nodelist[n] is O(n)
LAUGHING MY ASS OFF @FlorianMargaine
I deleted my suggestion. I intensely dislike uncommented downvotes and people not upvoting back after they have been corrected. — mplungjan 1 hour ago
delusional much? :D
 
@Esailija flagging as "off topic"
off the three downvotes he had, two were commented
and he didn't even correct...
 
in fact he himself admitted that it's slower
I see on my Fx12 and Chrome19 on XP that getting the text (the first statement in my JS) takes 2MS on Fx and 3MS on Chrome using time and timeEnd - getting it as HTML takes 2-4MS longer. The whole script which gets the text twice from the ODM takes 13MS and the split itself takes 1MS – mplungjan 1 hour ago
 
Thing is, putting like 5mb string inside some element will probably crash the browser
 
@Esailija who cares btw
 
9:06 AM
where as holding a 50mb string in memory is np
 
guess so
let's try it
:D
hm
first, let's generate the string
something like Array(5000000).join('') I guess?
 
document.body.innerHTML = Array(50000000).join("b")
var holdInMemory = Array(50000000).join("b");
holdInMemory is done after 0.4 sec
:X
I let that innerhtml script run for 2 minutes and then gave up
 
yep
well I just killed the process :D
 
dom is slow is obvious
 
9:10 AM
stay away from dom is common knowledge for performance
 
(htmlcollection vs nodelist)
yep, dom is the slowest thing in browsers, everybody knows that :p
if it looks like a duck, walks like a duck, quacks like a duck, it must be a duck, right?
 
it would probably be good to build your ui in a canvas element
 
well, HTMLCollection is not an array.
 
though
then you are dealing with low level events, and must calculate coordinates etc to determine what action to take
 
what are you talking about?
 
9:13 AM
avoiding dom altogether and just doing ui programming like it's done in normal programs
via canvas
 
oh
yeah I already thought about that, unfortunately SEO doesn't like that
and iirc, I've seen something like html2canvas
 
in fact that would warrant a MVC framework
 
haha
 
11
A: HTML5 Canvas Library for UI Widgets

Simon SarrisThere aren't any fell-featured ui widget libraries yet that I've seen, but I guarantee they will be made someday, if only because people will demand them (for good reasons or bad). The HTML5 Canvas specification itself heavily advises against trying to do it. As the spec says: Authors should...

> The HTML5 Canvas specification itself heavily advises against trying to do it.
 
9:18 AM
yes because you are stuck with low level events then
but with HTML+CSS+DOM you are stuck with weird UI development
people are just trying to apply the normal ui develpment there (google closure, mvc)
and it just adds shit ton of accidental complexity
 
additional*
 
some wise people have said that these weren't designed for UI development
but I don't think forcing the normal UI development paradigms on it works well either
bootstrap understands this and requires certain html and css to avoid stuffing that shit in javascript
 
this clip is awesome
 
:P
 
but yeah, html is for content, not ui development
1
Q: js / jquery function call order not reflected in result

Marc05EDIT: Alright, to help resolve this, I've put up the example online: http://lodge323.com/test/index.html The example works as intended, but it doesn't have the content that I want on it. Note that this apparently only happens on FF13 and not IE9. Steps to recreate the problem: -Ctrl+F5 to relo...

look at the avatar...
 
9:26 AM
yeah I've seen 15+ accounts with that avatar :P
 
oh ^^
Zirak's was first I saw
 
it's a lot like PHP
it has "evolved" to support ui developement somehow
 
uh?
you mean php templates?
 
well php was first a templating engine
but it has evolved o be a programming language
 
oh? didn't know that
 
9:29 AM
how have you rationalized the utter crappiness as a language so far then
as a tool it's great of course
 
haha
-2
Q: Need to find the Password attribute Value in the javascript code

Muru Sk/* RequireJS Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. Available via the MIT, GPL or new BSD license. see: http://github.com/jrburke/requirejs for details */ var require; (function(){function j(q){return B.call(q)==="[object Function]"}function a(q,r,t){return function(...

LOL
 
haha
if you stare directly at the wall of code you will be turned into stone
 
10 downvotes, closed in less than a minute
that must be a record
@Esailija lol'd
added the question as favorite :D
 
@Esailija: I will be turned into stone? Well, at least I don't have to look at the wall of code anymore...
 
9:44 AM
0
Q: How to retrieve a value from js file?

Wondering CoderBasically my question is How do you get the value of a variable inside a js file. E.g var now = (new Date() - 0); other_var = 'Whats up';//how to pull the value of the other_var which is 'Whats Up' key.embed(); How do get the value of the other_var using php? I only need the value of the va...

again...
we really need to shout out to the world: client !== server
 
Hello everyone!
 
@Esailija lulz
Please provide what you've been smoking — mattytommo 2 mins ago
 
"please provide code..." "please provide what you have been smoking" :DD
 
Does anyone know, how to set raw value for attribute with jQuery?
 
9:53 AM
what have you tried
 
what have you been smoking
@Esailija lol at the question too
 
Tryed like this $('<input type="button" value="' + button.value + '" />');
 
"hello there whats up"
 
Where button.value can be &nbsp;&lt;&nbsp;&gt;&nbsp;
And it works.
 
$('<input>', {type: "button", val: button.value});
 
9:54 AM
But
 
$('<input>').attr({
    'type': 'button',
    'value': button.value
});
 
var buttonObj = $('<input type="button" />');
buttonObj.attr( 'value', button.value );
If I try like this then I see escaped value
 
@Esailija oh I didn't know this syntax
 
it calls .attr with the object
				if ( jQuery.isPlainObject( context ) ) {
							selector = [ document.createElement( ret[1] ) ];
							jQuery.fn.attr.call( selector, context, true );
 
9:56 AM
btw you can set val and it will call the .val
 
@Esailija still escapes
 
	attrFn: {
		val: true,
		css: true,
		html: true,
		text: true,
		data: true,
		width: true,
		height: true,
		offset: true
	}
 
yeah saw that
 
Hey guys, I just have a quick one about using Javascript to validate a form. It's basically to make sure they enter a valid e-mail address. The problem I have is that it checks it the first time but after that they can just pass through and it fails to check it. Anything I can do that might fix this?
 
@Eugene what do you mean
it will insert the value exactly whatever the hell is button.value
 
9:58 AM
@Bananaco: Sounds like a global variable that has been set in the first try and needs to be reset before the second try.
 
@Zeta this is what I have function validateEmail(value){
atPos=value.indexOf("@");
if (atPos<1){
alert("Invalid Email address");
return false;
}
return true;
}
 
global variable detected
 
that definitely won't be enough to detect an email address tho
 

« first day (601 days earlier)      last day (4350 days later) »