« first day (660 days earlier)      last day (4294 days later) » 

7:01 PM
doctor say i need sleep :-/
 
@HarryBeasant Then using a what?
@Abhishek yes you do
 
@Esailija hum yes... Except if you live in Iran, non heterosexual guys exists ^^'
 
ah yeah of course:P
 
Alright i guess
am going to sleep :-/
 
i slept 1 hour today
 
7:04 PM
Hi everybody, i'm searching for a way to get the height of a div that have a dynamically rendered menu. i've tryed with the framework jQuery with innerHeight innerHeight() (give me 22 who is the height of the first line only) and height() (give me 0)

Any other idea ?
 
that's not really enough though :/
 
@JonathanLaf elem.getBoundingClientRect() developer.mozilla.org/en-US/docs/DOM/…
 
Thank you @Loktar i'll take a look at this got to bet back in a few minute
 
theres a few other ways too
 
jQuery uses getBoundingClientRect(), where supported
how about that
 
7:06 PM
@Esailija hah nice
where isn't it supported?
Im making a cross browser game (have to support IE7) and it was the best way for me to do it
 
Feature	Chrome	Firefox (Gecko)	Internet Explorer	Opera	Safari
Basic support	1.0	(1)	4.0	(Yes)	4.0
ok so I guess it's supported
 
yeah I was surprised when I saw the support for it
pretty badass function
 
I was fooled by jQuery's code:
if ( "getBoundingClientRect" in document.documentElement ) {
that suggests it's some wizardry
 
ah yeah
 
that only the bestest browsers support
 
7:09 PM
guess they are just being overly cautious
 
I love finding this stuff that has actually been in IE since 4.0
like .insertAdjacentHTML
firefox only added it in 8.0
 
if(2+2 === 4){//ensure math still exists
10
 
and i still dislike all these crazily long function - names of the DOM API :/
 
ahahahhaah
is there, getBoundingServerRect()
 
So I'm having issues with a minifed JS library :'(
 
7:12 PM
does it work unminified
 
I can trace execution the point where I make seemingly valid calls to the library... but then it's all if(a.b() == c) { d(); } .. BUH!
There's no unminified one available ;)
 
I thought you implied that a library breaks when it's minified
oh well
 
No, rather it works in some browsers but not others. Unfortunately there's no unminifed version available.
I'll never know why I guess :)
 
what does the library do
 
a day in the life of a JS programmer... sigh
Google chart/map stuff
 
7:14 PM
yuck
 
name of the lib?
 
yep...they don't provide unminified versions
Also the Google Maps for Business API...don't have an open link
They give you an API reference [developers.google.com/chart/interactive/docs/reference] etc but not unminified code (which would be really helpful)
 
data = ['a','b', ,'d']; // Also OK. The third value is undefined.
lol how is that ok
I would shit my pants if I saw code like that
 
It gets better...I asked on their enterprise support group what this means:
SCRIPT87: Invalid argument.
format+en,default,browserchart,scatterchart,table,annotatedtimeline+en_US.I.js, line 83 character 25
Their answer: "Look at line 104 of main.js; it is self-evident."
Line 104 of main.js: K.Fb=function(a,b){var c=ya(this,a[A]);Yp[H](this,c);Ma(this,a[ad]||a.srcElement);qa(this,b);var e=a[Xa];if(e){if(Zn){var f;a:{try{Up(e[ub]);f=i;break a}catch(h){}f=l}f||(e=k)}}else c==Fk?e=a.fromElement:c==Ek&&(e=a.toElement); ......... it goes on. Very self-evident -.-
 
haha
well at very least use beautified version of the minified code
then you get correct line at least
 
7:18 PM
yeah, i've been playing around with that
It's just obnoxious :)
 
hey - has anyone ever used labels as radio buttons ?? like this
<label><input type="radio" name="toggle" checked="checked" class="_today"><span class="css3button-left">Today</span></label>
 
oh, i just love watching the relieve and joy of the team of the curiosity - project.
 
any one?
 
yes, radio buttons without labels should be nuked from orbit
 
no, I mean , they appear as buttons , the button has a label , but function as a radio button
 
7:26 PM
@Esailija don't hurt my helpless little VM :(
 
@ScottSelby is there a problem?
 
yes, its works on every browser just fine , except for on the stupid ipad
 
oh well
 
on the ipad - the CSS won't change when the radio button changes to checked
 
CSS, as in :checked?
 
7:28 PM
correct
 
i'd just add a class if you ask me
 
do you know whether it's just the css or not working altogether
 
iOS safari can be a bitch
 
no, because I have no clue how to debug this stupid ipad
if you chose "Developer Mode" , there is just a little box that says" no errors" - thanks a lot apple
 
yes, it sucks
 
7:30 PM
well is there a console where you can log
checkbox.onchange = function(){console.log(this.checked)}
 
there is Adobe shadow, but it's not working that well
 
or maybe even alert
 
test
aha
 
so you'll have to console.log - debug
 
that works
 
7:31 PM
@Loktar i'm not very familliar with pure javascript always using jQuery, how do i get elem is it with var elem = getelementbyid("#id"); elem.getBoundingClientRect();
 
drop the #
with these native selector-functions, you just need to pass the name of the id/class
 
^
 
you could .querySelectorAll
 
^ also
 
and it's getElementById
camelCase
 
7:32 PM
it's document.getElementById
 
var elem = document.querySelector("#id")
 
.querySelectorAll will feel a lot like jQuery to you.
 
Hmm... I guess you have to reset your computer for command line stuff in shortcuts to take for Chrome. (?)
 
but it ends there, the separation of 0, 1 and n is a bitch
 
Better than Java: Div a = new DivGetter(new DivHolder(new XHTMLReader(new XHTMLImporter(new HTMLFile(new File( .....
 
7:33 PM
Thank you guys, it seamsly work, but I got [object ClientRect] how do i retreive it ?
var elem = document.getElementById("third_menu");
var elemInnerHeight = elem.getBoundingClientRect();

console.log("elemInnerHeight : " + elemInnerHeight);
 
@JonathanLaf If you console.log() it you should be able to inspect the object properties
 
var elemInnerHeight = elem.getBoundingClientRect().height
 
@Esailija thank you
 
it returns a rectangle object which has properties
such as .height
 
@JonathanLaf this is what I use
function getOffsetRect(elem) {
		var box = elem.getBoundingClientRect(),
			body = document.body,
			docElem = document.documentElement,
			scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,
			scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,
			clientTop = docElem.clientTop || body.clientTop || 0,
			clientLeft = docElem.clientLeft || body.clientLeft || 0,
			top  = box.top +  scrollTop - clientTop,
			left = box.left + scrollLeft - clientLeft,
			right = box.right + scrollLeft - clientLeft,
crap..
 
7:35 PM
@Sparky http://jodd.org/doc/jerry/index.html
(just don't tell anyone I knew ANYTHING about Java or its libraries)
 
takes into account the offsets for diff browsers
 
that's returning me 22 has in .innerHeight() and it's only the first line height not the whole div !
 
@ErikReppen I love you.
 
@JonathanLaf if you just output your variable elemInnerHeight, without adding it to some string, you'll be able to inspect the returned object and it's properties (if you use a browser, that is)
 
@GNi33 thank you ! that's because of the string in front that I can't inspect it !
 
7:36 PM
exactly
 
@Loktar looks close to what jQuery has
getOffset = function(elem, doc, docElem, box) {
    try {
        box = elem.getBoundingClientRect();
    } catch (e) {}
    // Make sure we're not dealing with a disconnected DOM node
    if (!box || !jQuery.contains(docElem, elem)) {
        return box ? {
            top: box.top,
            left: box.left
        } : {
            top: 0,
            left: 0
        };
    }
    var body = doc.body,
        win = getWindow(doc),
        clientTop = docElem.clientTop || body.clientTop || 0,
 
@Sparky I actually became aware of that through one of its authors asking questions on Stack.
 
@Esailija theirs is way prettier
 
because it will output just a string. Adding an object to a string automatically calls it's .toString() function
 
some edge cases like disconnected node
which are just not needed in a controlled environment
other than that it looks the same
 
7:37 PM
@ErikReppen Bookmarked that. Gold star for you!
 
yeah ive had to do a lot of dumb stuff that I normally wouldnt since this has to work in IE7
also not using jQuery because I don't think I need it
 
-1
Q: Youtube bot in Javascript

TheGhostOK, so I have some Javascript code, but the thing is, I don't know if it works or not. The Javascript code is supposed to : remove the ".mp4" extension from every title change my video category put the same description in all of the videos put the same keywords in all of the videos So, that J...

Seems legit, am I right?
 
4 upvotes for an answer that took the first syntax error in OP and copypasted it without fixing
I love SO
 
:P
 
So, I'm about to undertake a mouse-to-touchscreen-UI project. I don't think we have any hovers or double-clicks going on in this thing. Is there anything else that's not going to go over well in a touchscreen?
 
7:39 PM
I'm tempted to answer "Yes." and nothing more. Is it worth a few karma? :D
 
yep, i don't get what people are upvoting sometimes
 
OH WAIT IT GETS BETTER
the OP doesn't even have that syntax error
 
@Sparky are you a redditor? it's called "reputation" on here :D
 
lol!
 
@GNi33 Guilty :P
 
7:40 PM
@Esailija what? let me check
 
oh wait it's possible the op fixed it in the question as a reaction
so now the answer is useless as shit
 
yes he has?
 
no the OP has:
document.getElementsByName("description")[x].value = "Visit me on my web-site :\
\
sample.com/";;
that's valid
 
@Esailija So it can still be used as fertilizer?
 
ah, yeah, he edited it, the indentation is just screwed up :P
 
7:42 PM
I'll repeat myself: Seems legit, am I right? ... Pretty sure OP is a script kiddie trying to make a YT spam script :)
 
oh yeah, that
some kind of mass uploader helper
 
i've maded some test, and with nothing else then the script everything work perfectly so I understand that the problem is not comming from that part, something make getBoundingClientRect getting wrong
jsfiddle.net/PS9KG (working) but on my page is not
 
the code in jsfiddle by default runs in window.onload
maybe that's the difference
 
that could be a reason, yes
 
Ho i'm running it inside document ready of jquery
 
7:45 PM
so...
why are you trying to implement that check yourself then?
it already is in jQuery, you know
 
God damn there's a lot of stupid "will touchscreen kill the mouse?" articles out there. No, it won't, you idiot !@#$ing tech-writers. Now stop polluting my google search results with your garbage already.
 
lol touchscreen kill the mouse..
 
of course it will!
 
same thing on window.onload
 
nobody likes a mouse
 
7:46 PM
@GNi33 cats do
 
i like to punch my screen instead of throwing my mouse against the wall when IE7 upsets me
so, touchscreen is definitely the way to go here
 
-22
A: Recursion or iteration?

klydeyou should avoid recursion at all costs in any language! recursion causes unnecessary repeating computations and will slow your program to a crawl. Try generating factorials by recursion and you'll see what I mean. You should always try to cache results that will be used again instead of repea...

hehe
 
I love the guys who know how every language works.
 
lol
I've said it before, and I'll say it again: Recursion makes me unreasonably happy.
 
recursion feels like magic
 
7:52 PM
Exactly!
 
I imagine a snake eating itself
and then giving me the answer
 
only if there isn't a stupid mistake when executing the first time
 
@RyanKinal I'll see your reply and raise you one pun.
 
haha yeah
infinite recursion... damnit I forgot to save!
 
Recursion makes me LOOPY.
 
7:53 PM
Iteration: "Oh shit a big problem!"
Recursion: "Oh, hey, a small problem. Oh, hey, another small problem."
2
@Sparky :-P
 
If you don't understand what recursion is, read this sentence.
 
"Let's just use recursion here..... just like that.... oh yeah, that looks good... let's try...."

freeze

*loudcry*
 
@SomeKittens Well i'm back in Canada now, and I wasn't 'consulting' per say - We have developed an embedded OEM solution for our control system and I was working with a big dryer manufacturer who purchased a bunch of them helping them integrate their HMI and PLC with our product.
HMI programming... not so much fun.
 
Man, just talking about recursion makes me a little giddy.
 
you know what's even worse?
 
7:54 PM
I kinda feel like this guy:
 
if you write:
 
@GNi33 Inline assembly?
 
@RyanKinal haha that guy is nuts
 
for(var i=0; i<length; i+=0)
and just don't manage to see the error for 5 minutes
 
Tbh that guy with -22 is right
 
7:55 PM
made me wanna quit my job and become a nascar race driver or something like that
 
there are more people abusing recursion where iteration is more appropriate than there are people using recursion properly
 
@Esailija But that doesn't mean recursion should be avoided at all cost.
 
I love node's cryptic errors happening in a module that you have no idea it even existed
 
@GNi33 that's really subtle...I'm going to slip that in somewhere that I want a line executed only once ;)
 
7:56 PM
well as an advice to the average programmer it's pretty sound
 
@Sparky only once?
 
@GNi33 keyword was subtle ;)
 
It is. He just got spanked because everybody is sick of "NEVER EVER DO THIS IT'S BAD - LIKE LICKING SATAN!!!"
3
 
@Esailija If that's true, then I'm severely overestimating the "average" programmer.
 
7:57 PM
LOL like licking satan
"IT BURNS!"
 
hahaha
 
@RyanKinal yeah it happens but when you think about it, all these retarded questions are most likely made by the average programmer
or maybe SO just draws in the lower end
 
:-(
 
@Sparky this won't execute only once though... :D
 
define "average programmer"
 
7:58 PM
@GNi33 that was the joke.
 
I think SO draws a vast amount of internet noobs.
 
does it count india in?
 
@GNi33 the keyword was subtle ;)
 
Because most answers could be found with quick googling.
 
when you think of the average question in SO you want to kill yourself
 
7:59 PM
Let's rip on Infosys, not India. So you know, like half of all India.
 

« first day (660 days earlier)      last day (4294 days later) »