« first day (677 days earlier)      last day (4276 days later) » 

12:24 AM
i thought this was the global object if you're not being called as a method
jsfiddle agrees
 
12:50 AM
ahh...never mind. yeah, it's undefined in strict mode
apparently not a strict mode violation though
 
look at my college's home page banner
 
@FlorianMargaine JSHint is branched from JSLint. And here's why it was branched (awesome Crockford quote at the link):

http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/
 
α = √(5-1)/2
meta chat not working for anyone else?
 
1:11 AM
yeah, looks dead seems to be back
 
 
1 hour later…
2:11 AM
0
Q: Help optimizing a function to count the rows in a textarea

st-boostI am writing a script to count the number of rows in a textarea, and as it will be called on every keypress I want to make sure it runs as fast as possible. I'm not aiming for a general solution: we can assume that the textarea has a monospace font and enough horizontal space for exactly 80 chara...

 
 
3 hours later…
5:23 AM
0
Q: My first implementation of mongoDB

ThomasReggiI'm new to Code Review, my assumption is that it is a place I can get feedback on working code that I've built, I hope that is right. This is my first implementation of mongoDB, much much more to come. This sheds light on some things like how i've structured my collection. I hope to gain feedbac...

 
5:52 AM
I just ran this in data explorer
SELECT Id, DisplayName, Reputation, Location
FROM Users
WHERE Location LIKE '%Finland%'
ORDER BY Reputation DESC
I am 2nd highest in reputation in finland.... 500 rep behind the top account
:D
 
6:33 AM
@Esailija Hi - good morning ( 9:30 am- israel)
 
yeah, I'm in finland... exactly the same timezone ^^
 
@Esailija hh
@Esailija Does posting via jQuery ajax (post !) does uriencode ?
or is it just for GET ?
 
for both, if you pass in an object
 
What about if I pass "John+Yoko" (string value for key)
what about the '+' ?
 
data: {key: "äää"} will become key=%C3%A4%C3%A4%C3%A4
 
6:35 AM
will it be %2b ?
 
yes
prefer %20 for spaces... I never understood what's the point of +
 
thanks
@Esailija I have a script which I build as string , and want to display it to a user with the same (!) line breaks as I build it.

var ScriptSTR = "<script type='text/javascript' >";
ScriptSTR += "var s_PC_s = dddd";
ScriptSTR += "var pc_s = aaaaaaaa";
ScriptSTR += "</scr" + "ipt>";

How Can I display this script (for him to embed) with the same line breaks

I didnt like the <pre> tag.....
 
btw if you are passing a string directly jquery won't touch it
data: "str=value" will be untouched
I have to go to school now I am in a hurry sorry gotta go
 
4 min my friend , (phone from boss)
ok
bye
thanks
 
7:30 AM
@RoyiNamir you no longer need type='text/javascript in your script tags as of html5
 
7:51 AM
Anyone know how we can inspect the Chrome console?
I want to see how the console works
I think in earlier versions we could just right click and Inspect element
 
when created elements with
var testDiv= document.createElement('div');
how to set its id:
testDiv.id = 'myuniqueDivID';
Or
testDiv.setAttribute("id","myuniqueDivID")

Asking because I can set the class with .class but doesn't seem to work with id ?
@Purmou You sure? how backward compatible is it not to write it?
anyone? :-i
Hmm I can see it is there in the html (firebug) but it can't find it using the document.getElementByID ?
 
@AndersMetnik That should work
Set up a JSFiddle where the problem persists
 
Okay let me look at it :)
Danm it's extenssive, will take a while to create in fiddle :)
 
8:11 AM
There has to be something else
Maybe the ID is being changed by something else
Anyway, afk
 
@Amaan
3
A: Is it possible to output all the code I've typed into the console in the last session?

EsailijaOpen up a new web inspector while in the current inspector (ctrl+shift+j, they removed recursive inspect element), then do this in the new inspector: console.dir(WebInspector.consoleView.prompt._suggestBox._textPrompt._data) Just to be clear, you don't run this in the inspector for the page. Y...

 
Question (silly one but important to me): If I write in page 5 times <script src="js.js" />....will the browser will parse this script 5 times ?
 
8:27 AM
@AndersMetnik you should be setting the class with className, no?
 
yes
though it will most likely download it only once
but it's parsed and executed 5 times
 
@Esailija what about different js and same method ( different implementation) ? which one will win ?
 
they are executed in order
 
@Esailija ?? in one js file i have function do(){ alert('1');} in other js I have function do(){ alert('2');}...now I write do(). .... wil both run ?
 
8:30 AM
no the second file will overwrite it
 
@Royi imagine you're just appending the second document's text to the first
 
what would happen if I were to accept my own answer? do I get my own bounty, complete with selfish turd badge?
 
the second do() declaration overrides the first in both cases
 
@EliasVanOotegem use jQuery, nobody will write the 1500 liner there
you need to create own event system to do it cleanly
or you can just copy it from jQuery soure, wasting tons of time integrating it
since you are doing cross browser it's insane not to use a normalizing library
 
i love how jquery 1.8 comes with customizable code
 
8:33 AM
Solved it, with help from colleague, else thanks :)
_to all :D
 
@Anders were you appending it anywhere? 8D
 
Do you know how Stackoverflow implemented this chat ? which technology ?
 
they had a list somewhere
let me go dig it up
 
SignalR ? weBmessage ?
Iframe proxying ? hhhhh lol
 
@Esailija: I'm not using jQuery. Partly because I have thousands of lines of code already, partly because I love pure JS (and I feel that jQuery makes your code look messy quite quickly) but mostly because I have no use for it other than this one case
 
8:36 AM
@EliasVanOotegem then get a custom built jQuery with just events
 
how does jQuery make your code messy? It's you, not jQuery
4
if anything, writing 100 lines instead of 1 makes messy coe
 
I admit that in this case, using jQuery makes sense, but on the whole, I do little dom operations
 
@Purmou just a typo in a function parameter :-/
 
@Anders: lol, happens :P
15
Q: What technologies were used to build the chat?

Bill PaetzkeI realize there is a similar, broader question here. But the answer is old and does not include the chat technology. Let me know (even if they completely rolled their own). Thanks! I am most interested in how they implemented Comet (aka HTTP push) it in .NET.

i use jquery for animations, events, and some DOM manipulation
toggleClass() is a lifesaver
 
@Esailija: there's just too many brackets,

$('foo').on('click',(function (closureVar)
{
return function(e)
{
//
}
})($('#bar'));
 
8:39 AM
though i admit is probably a simple regex to remove and pretty simple to add, too
 
thanks
 
@EliasVanOotegem why not this:
$("foo").on("click",function(){
    var closureVar = $("#bar");
});
 
making it, harder to debug.
 
@Purmou Yeah thanks, a little too much imho ;)
 
@Purmou: Because you'll scan the DOM on each click, using a closure is more efficient. It's just an example, though
 
8:42 AM
@Esailija how come typeof lalala == undefined is working ? its a function and function should use parenthesis like typeof (lalala)......"
 
i guess cause it finds no variable named typeof, or better yet, typeof lalala as a phrase is undefined?
 
I've posted an answer to a question recently about intervals. I suggested combining closures & recursive functions. when you mix that into jQuery, it makes for hard-to-read code. It's my opinion jQuery enforces a syntax that makes closures harder to maintain
 
@RoyiNamir it's a special keyword
like void
 
Can i implement one of my own like :[ mySqrFunc 9 ] ?
 
nope :)
not that I know, at least.
but it looks like you'd be interested in coffeescript
 
Why does people always use in xxx.prototype these chars : __ ?
 
example?
 
9:06 AM
good morning
http://stackoverflow.com/questions/7978373/difference-between-doom-and-quake-3d-rendering


People in the world
 
oh hey @Abhishek, your solution works grealy margaine.com/Snake
it's smooth
 
:-)
my pleasure , it was helpful
am trying to write my first blog article :D
 
:-)
@ErikReppens code gave
me a pretty decent idea
 
9:24 AM
hii..
how to add multiple events to be listened by a element just like jquery bind(), trigger()..
 
@RoyiNamir it's a non standard way to access the prototype
@CodeJack $('..').bind( 'click dblclick', function() ...
 
@FlorianMargaine whats the best replacement of operator overloading in JS ?
and dont say functions ^_^
 
there isn't
 
:-(
damn
 
with bind() u can add only one event to an element..if you do two events its taking the last one only...
 
9:30 AM
with on() you can add several
been a while since I haven't used bind()
 
trigger() works with on() events???
 
@FlorianMargaine arguments.callee is deprecated right ?
 
@Abhishek: It's discouraged, and even throws errors when used in strict mode. here's more info
 
It was soo cool though :-(
 
Found the link in one of John Resig's comments
It's an easy fix, though
function()
{
     arguments.callee();
}
becomes
function fName()
{
     fName();
}
 
9:49 AM
@EliasVanOotegem how about this
function Error(){
console.log("A logical error was detected in the function",arguments.callee);
}
 
@Abhishek: But, personally, I'm with you there, and I think you, John Resig and me aren't the only ones who'll miss this property. But yes, for some reason it's deprecated (mostly passing the arguments object to other functions proved tricky)
 
@EliasVanOotegem i understand why the deprecated it though
as per strict mode
there should not be reference to global
all and all stuff stays inside a scope , right ?
 
Hello..I'm stuck with passing some values with a JS function. Can anyone help me? Should be pretty easy.
Firstly, does this look right?

colour_change(nav_items,000,"fff");
The last two args are colour codes.
 
i see no problem with it
 
My function:

function colour_change(ele,start,end){
ele.hover(
function() { $(this).animate({color:"#".start},200) },
function() { $(this).animate({color:"#".end},200) }
)
}
 
9:52 AM
Not exactly, the global object exists in strict mode (JS can't do without) and can be referenced, still. But it's not implicitly writable (undeclared vars don't get lifted to global, but throw errors)
 
@Dan you are using php ^_^
inside js
 
nooo.
 
in js "+" operator is enough to concatenate strings
and you are using "." operator in place of it :-)
 
What is the value needs quotes though?
 
but declaring named functions or var fName = function(){} never created globals, if I'm not mistaken
 
9:54 AM
@Abhishek lol, php
 
function colour_change(ele,start,end){
ele.hover(
function() { $(this).animate({color:"#"+start},200) },
function() { $(this).animate({color:"#"+end},200) }
)
}
 
I wonder if I could concatenate like PHP (in my ignorance) :D !
 
@EliasVanOotegem consider this arguments.callee
naming a function out in global scope
from a function inside strict mode
which must not happen
 
no idea what strict mode refers to
 
its like Obama being made the ruler of the universe
@Purmou OOPS SORRY
 
9:55 AM
LOLOL
confused me there
 
kindly excuse me
 
no problem
 
i am still brushing up my brain out of the damage it has taken :-/
 
ok...so the "+" works fine, but I had to pass the black (000) with quotes or it doesn't work. Thanks very much for the quick help : )
 
@Abhishek: Strict or not, naming a function inside a function scope Never created a global reference, it's processed as var name = function definition, with the var,
 
9:56 AM
@EliasVanOotegem not creating a reference
but its actually overriding the limitations that are generated by strict mode
 
indeed, no global reference, hence no error is thrown
 
// excuse my words i am just out of my vocab
 
No, not really... even when not using strict it's like that. Consider this:
(function()
{
     function bar()
     {
           console.log('I'm bar');
     };
     console.log('Bar is in scope here');
})();
bar();//<-- is not defined
 
var bar;
(function()
{
     bar = function()
     {
           console.log('I'm bar');
     };
     console.log('Bar is in scope here');
})();
bar();
what about here?
8D
 
(function()
{ 'use_strict';
     function bar()
     {     f();
           console.log('I'm bar');
     };
     console.log('Bar is in scope here');
})();

function f(){
  console.log(arguments.callee);
}
@EliasVanOotegem and what will happen here ?
oh we get a name of a function which is not even defined in this scope !
with a reference to it
maybe i am confused with strictMode myself
but this is kinda not good :-(
 
10:02 AM
just don't use argument.callee
 
                var button = document.createElement('button');
                var buttonID = 'button'+view.departmentId;
                button.id=buttonID;
                button.style="display:none";
                button.innerHTML=" Ok ";
                button.onclick=function(){

                };
                newTD.appendChild(button);
This doesn't work, the button is still visible? :/
 
function f isn't strict, so arguments.callee will work just fine (that is-> if you call bar :)
 
@FlorianMargaine :-(
@ShyamK , hello :P
 
@AndersMetnik: button.syle.display = "none";
 
@EliasVanOotegem Ohh duh, thanks :D
 
10:09 AM
hey bro
@Abhishek
 
sup ?
long time
 
@Abhishek the only use of arguments.callee I've ever had was usually in a setTimeout, and you dont need it
 
@FlorianMargaine finally am back in action :D
just crashed browser :D
 
making a js game :D
for the blog article
:-)
@FlorianMargaine is there any method to stop javascript execution ?
 
10:16 AM
not that I know of
hm actually
if you have the debugger opened
you can click on "pause"
is my comment right?
 
@shyamK do you know the code for animating the text for canvas html5
 
10:35 AM
lol
 
@Ritesh nope...
 
@FlorianMargaine he looks like he cut himself and bleed to death
then some horse blood was donated to him
that was infected by rum and vodka
:-? and ziraks Dna
 
the first entry of Google search.. http://www.8bitrocket.com/2010/05/15/html-5-canvas-creating-gaudy-text-animations-just-like-flash-sort-of/
Just use Google..
 
11:07 AM
I'm back to Nag: One more hour Who fancies a crack at it?
 
@EliasVanOotegem not my peice of cake :-/
but you should consider asking raynos , florian , esailija about this they have much deeper understanding here then i do
 
@EliasVanOotegem I'm seeing too many questions in this one, sorry
 
11:23 AM
@Elias do you know how to write the canvas html5 text within the canvas?
 
@FlorianMargaine i have been browsing the web for input loops for js based games
seems js is really ugly for gaming so far
 
"input loops"?
 
i kinda like to keep all input in a seperate loop
and the logic in a different loop
 
what do you mean with "input"?
 
keyboards , mouse
 
11:26 AM
why do you want to put them in a loop?
 
brb i would discuss this more after a lil bit munching
@FlorianMargaine helps optimizing the game performance
 
I don't see what you mean
one event listener only, no loop
 
                        button.onclick=function(){
                            var callback = function(){
                                trtbodyElement.innerHTML="";
                                trtbodyElement.style.display="none";
                            };
                            saveStyleResult(view.id,callback);
                        };
function saveStyleResult(id,callback){
   callback;
}
Is that how I call the "callback" ? :)
or callback(); right?
 
callback();
 
11:42 AM
thanks stupid head of mine ;)
 
@FlorianMargaine thats so because u just want one change at a time :-/
i know there is a good trick to have flags of buttons pressed and stuff like that
but that requires an independent method :-D
hmm maybe i should write some code maybe u understand then
 
12:02 PM
@Abhishek yep, even if you mean multiple clicks at a time and then checking the flag, it's still one event listener
 
@Abhishek: Esailija suggested jQuery (which I'm not going to do), @FlorianMargaine: Sorry for that :-P it's just one of those things where I underestimated the problems IE causes @Ritesh: not off the top of my head, no. But have you googled it?
 
hi everybody. Can ı ask a question?
 
ask it, we'll answer if we can :)
 
ı am writing an exam management adn content management system with asp.net, javascript and web service
 
@FlorianMargaine my C background was clashing :-\
nvm i figured it out hehe
 
12:10 PM
ah yeah
 
but now i am trying to write something lets see how it goes
 
you can look it from here
 
in C you need to loop through fget to get the input
 
fget :o ?
u kidding me (x_x)
for games fget === death_garunteed
 
12:11 PM
on the left pane you should see a grid
on my personel pc it works fine
now ı am at work and it works fine
bu two of my friends pc not working
 
@Mehmet what browser are your friends using ?
 
when ı debug with ie developer tools on my friends pc.. it says acces denied on calling web service
 
Internet Explorer ?
 
ı tired different browsers
ır, chrome and firefoz
firefox
 
intresting then
 
12:13 PM
ı am calling web service with jquery ajax method
did you tired link?
is data coming on your pc?
 
yes
wait a minute , is your friend using firewalls ? or are they at work ?
 
no their home pc
 
firewalls ?
 
firewall is open on my pc now
but it works
 
untill unless somebody can recreate it here its hard to tell
 
12:16 PM
they have anti-virus programs
ı have avg antvirus bu it is working
can anybody try the link?
Florian Margaine man can you try link abow?
is anybody here??
 
12:31 PM
is data coming man?
 
@FlorianMargaine guess what is "vocaroo doing"
 
left pae on grid?
 
'mornin
 
@Mehmet I was able to enter.. and there is data on left side
 
ok thank you. two of my friends PC it is not wrking
no data comes
 
12:33 PM
Deneme Sınavı - 2
1
true
something like that
 
It absolutely does. If you actually spent more than 30 seconds to think you could assume the line i posted is within a php loop. Unless you have something constructive to add, please don't comment at all — Athos 15 hours ago
I love this guy
he says "it does have something to do with PHP!" then accepts the answer that is js.
 
I am so impressed
is incredible! they are streaming audio live from server as in really LIVE
 
@Mehmet: your code does contain an evil line (var _data = eval("(" + msg.d + ")"); <-- don't eval, I thing you're just parsing JSON
 
why dont use eval?
 
eval is evil
 
12:36 PM
what can use?
json.parse?
 
11
Q: Eval is evil... So what should I use instead?

m_oLoginAn ajax request returns me a standard JSON array filled with my user's inputs. The input has been sanitized, and using the eval() function, I can easily create my javascript object and update my page... So here's the problem. No matter how hard I try to sanitize the inputs, I'd rather not use th...

 
Or, since old IE doesn't always support JSON.parse: $.parseJSON(msg.d)
 
ok man thank you ı will change code
but
two of my friends PC it is not working when ı debug with IE developer tools o my friends PC.. it says acces denied on calling web servis line.. How this can be?
 
0
Q: Compare 2 Images

Andrew HallI am using the following code to compare 2 images: HTML (for example use only): <canvas id="gViewCanvas"></canvas> <img id="image1" src="image1.png" /> <img id="image2" src="image2.png" /> Javascript: var gOldImage = document.getElementById("image1"); var gScreenImage...

 
@rlemon o/
 
12:43 PM
Hey everyone!
I have a question about styling my resume.. can someone help me with that?
 
I should just post a question with that tag? it's ok to do that?
 
that tag means close it
and it not real
 
still 100 rep before I can CV
 
@SomeKittens *75
@Esailija you troll... you just use jQuery because you think the $ makes your code look blingy
:P
use jQuery because everyone knows $ == $$$$$$$
 
12:48 PM
Woo!
 
@Abhishek don't remember C that much, been a long time :p
 
@FlorianMargaine you should seriously do a lil bit C++
will make u feel like a boss !
 
@Rotem maybe this site would be better workplace.stackexchange.com
 
cause knowing js actually made my C / C++ code better!
 
@Abhishek heh... I don't know anything about C++ though
but it'd be fun, if I had something to do.
 
12:50 PM
@FlorianMargaine make your own js engine \o/ fun times for all!
 
just this? :D
I wouldn't even know where to start lol
 
@FlorianMargaine code.google.com/p/v8
 
@rlemon wanna overkill ?
or what ?
@FlorianMargaine C++ Room ^_^
 
@rlemon mind helping me with my collision detection stuff? I'm using this but it fails hard
 
// disclaimer :: The C++ room is like mount olympus dont try to be human or they will start playing human catch
( lastElem.x >= food.x && lastElem.x <= food.x + 5 ) ||
            ( lastElem.y >= food.y && lastElem.y <= food.y + 5 )
you gotta be kidding me
( lastElem.x >= food.x && lastElem.x <= food.x + 5 ) &&
            ( lastElem.y >= food.y && lastElem.y <= food.y + 5 )
thats it
 
12:56 PM
0
Q: How add a div inside Another div but in a random position

S. McGradyI am creating divs dynamically and would want them added to the parent div in random positions not in the last position e.g. var opt = document.createElement("div"); var txt = document.createTextNode(str); opt.appendChild(tx...

 
@FlorianMargaine see the minor change :$
 
told you, I'm stupid
 
@FlorianMargaine no you are NOT!'
never say that dude
 
lol I hadn't even read the code yet. I was still waiting for js fiddle to load so I could dump it there
(i like to play with it)
 
12:58 PM
i prefer my tough critic friend lilyas method :$
 
@Abhishek Unless it's the aforementioned GitHub/Dropbox thing
 
1) read source coderun with randomest possiblities
2) Dry
@SomeKittens :$
thats different but taht doesnt makes u stupid either
 
@Abhishek Are you calling me a capitalist?
 
@FlorianMargaine Have to agree with @Abhishek here you are definitely not stupid
 

« first day (677 days earlier)      last day (4276 days later) »