« first day (104 days earlier)      last day (4860 days later) » 
00:00 - 20:0021:00 - 00:00

Ab
12:07 AM
can u explain $.fn. part in above statement
i see that Carousel is the function, what does $.fn mean? an object?
 
0
A: Web Development IDE Suggestions

Raynoscloud 9 IDE It has gone into beta now. This is open source editor written in JavaScript. You don't like the editor? Write a plug-in in JavaScript for it. It has been made from the ground up for javascript. Admittedly this is aimed at node.js coders. The most awesome feature is that it's just a...

Is cloud9ide stable for use yet?
@Ab it's how your write jquery plugins
jquery.fn === jquery.prototype
jquery.fn.solveLife = function() { return 42; }

$(document).solveLife() === 42;
 
Ab
attaching 'fn' to jquery?
 
@Raynos VIM
 
@Raynos i'm on the list, but i haven't been given a beta invite yet
 
@IvoWetzel yes VIM is the win. But I am not hardcore enough :(
@david just fork and build it. Psh beta invite
 
12:12 AM
ahaha, too much effort :D
 
Oh wow cloud9ide hosts your code aswell :) You don't have to set up your own webserver
 
ooh, that's nice
 
Bet its hooked upto your github too
Man once cloud9ide get a good auto complete engine I'm game.
@IvoWetzel want to reverse engineer intellisense/intelliJ and OS it?
@IvoWetzel
43
A: How to wean oneself from IDE to text editor?

JimI don't understand why you would want to become IDE free? Why is programming like they did 20 years ago a virtue? It sounds like you just want to do this because that's what all the "uber" programmers do. Intellisense, refactoring, etc. are all tremendous evolutions that increase productivity....

 
12:27 AM
you will never know
something no mortal should ever see
 
A......
coconut!
 
What's going on here!
 
function object() {...}
object.prototype.dostuff = function () { this }

Any reason why this would reference the DOMWindow instead of object?
 
uh, how do you call it?
 
I'm using it as a callback
 
12:29 AM
if you call it in a setTimeout or an event handler
 
Do you have an actual object instance?
 
var Binder = function(fnc, obj) {
    return function() {
        fnc.apply(obj, arguments);
    };
};
can try something like that
let's you do this:
MyClass.prototype.delayed_foo = function() {
    setTimeout(Binder(function(){
        this.foo("Lols");
    },this), 1000);
};
 
>_<
thats a stupid wrapper
why have Binder(f, o) instead of f.bind(o)
I forgot you can't just code in node.js and have to support IE :P
 
12:38 AM
@Raynos hmm, never really thought to use bind like that, works well
 
@david not in IE and probably not FF3.5
 
Yeah I disregard IE... just like i disregard noscript users
no point trying to deal with people who are intentionally handicapping themselves
 
If your site needs JavaScript to work I'll turn it on
just make sure that it really needs it for whatever it does
I always hate it when I open up a page and see a complete mess because half of the layout gets created by JS...
 
RAGE. Where can I find a website that doesn't redefine Function.prototype
 
so you turn off js, and then get upset when things don't work right?
 
12:44 AM
No, I turn it off because I hate it when every site on the internet, no matter how simple, means, it needs to throw in half a ton of JS
What gets me upset is when things that should work with pure CSS/HTML are done via JS
 
document.write "Hello world".bold();
 
People need to stop overwriting natives like Function, Object and Array
 
@IvoWetzel that logic can be applied to CSS/HTML too though, most sites would look fine in plain text, I don't need all the pretty colours and unordered lists and stuff
 
People who do that deserve to die.
 
you know, there are some cases where I almost understand it.
 
12:48 AM
@david back on topic Function.prototype.bind isn't in FF3.6
Just like Object.defineProperty isn't either
Can't wait for IE9/FF4. I can just write ES5 then.
 
@Raynos That's fine, just add it in by overwriting Function.prototype >.>
 
Like we have one corporate web app interface to an HR system. It looks to me like the vendor hired some web experts to build it. The experts could not handle the vendor's weird proprietary backend horribleness, so they wrote almost everything in JS, at the level with which they were familiar.
 
Ab
@Nathan document.write("Hello world").bold(); worked for me
 
@Ab :D Don't tell Raynos
 
@David I'm going to rip your throat out
@Nathan @Ab since when is .bold() a valid method on ..
 
12:52 AM
@Raynos Function.prototype works well as a hash table too, cos you can access it anywhere. just do Function.prototype[whatever] = something, and it's available to all your functions later
 
Why is string.prototype.bold a method!
why does it return "<b>foo</b>" ;_;
 
what does document.write() return? the string it wrote?
 
@Raynos sorry to disillusion you. JS is a whore.
 
String.prototype.blink I'll murder IE.
 
LOL
String.blink() used to work in some browsers where <blink> had been desupported.
 
12:54 AM
@IvoWetzel document it :P
 
Ab
@Raynos strange, i tried document.write("Hello world").bold(); and since .bind() doesn't exist, should't firebug console or jsfiddle throw error... they didn't
 
@Ab your calling .bold not .bind. You see there's a o & a l in .bold
 
blink wasn't ie's fault, it was netscape
marquee was ie's fault ><
 
It's disgusting that you can call a method on a string and it gets edited in the dom. Bloodly live node lists :\
@Nathan you tricked me into thinking things
 
@Raynos oh yes, it is not really messing with the DOM, just the string.
I learned about String.bold() when I was looking for code at w3schools for code bowling a couple weeks ago.
1
A: Make an application that "encrypts" a string with a given key and can easily be reversed

NathanHTML and javascript. See output at JSFiddle. Thanks to w3schools for allot of the code! <html> <head> <script type="text/javascript"> var secret= "This is a secret secret very secret message, really!" var key= "09dbbb4ad3753068170966fa5c4a39c153c61a0e9db01ff44cfbb84f479e30fa"...

 
1:13 AM
a = {z:1};
b = {z:2};

(function(){
    alert(this.z);
}.bind(b)());
that's awesome
 
1:25 AM
@IvoWetzel free advertising for you. Link to garden please
0
Q: Javascript namespace pollution issue

AshleysBrainI'm just getting in to Javascript, so my first attempt at namespaces ended up looking like this: var myNameSpace = {}; var myNameSpaceProto = myNameSpace.__proto__; myNameSpaceProto.SomeFunc = function() { alert("SomeFunc()"); }; myNameSpaceProto.SomeObject = function() { alert("SomeOb...

This guys code looks so innocent and like an easy mistake to make. This is why I really dislike .__proto__ it's hard to see what's going on
@david try underscore.js
 
@Raynos +1
 
@IvoWetzel that stuff was a bitch to get my head around. I really don't like .__proto__
Also I -1 the other guy for being wrong. Is that harsh
is -1 for wrong or unhelpful ?
 
@IvoWetzel if that question was tagged node.js it would only get one upvote :P
 
1:37 AM
5
A: Where does node.js sit in the client <--> web server flow?

Ivo WetzelFirst of all a "diagram" of the usual flow: Client | v Request | v ...

just add some fancy ascii
 
wow Raynos, too fast. Was just looking at that asp.net one lol.
 
@Loktar @SLaks says I'm wrong
I dont get it.
 
2:22 AM
0
Q: Javascript for..in looping over arguments ie.for( arg in arguments) does not work in IE but it works in FF.

samarjit samantaHi all. I faced this strange situation where foreach like construct of javascript does not work in IE but it works in FF. Well not all for..in just this special funciton does not work. I will post the code. Tested in IE8. Tested also with XHTML DTD. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4...

It's W3Schools code! run.
 
2:47 AM
@IvoWetzel (stackoverflow.com/questions/4824328/…) Edit it and make it better. It's your code. sell it.
 
3:12 AM
0
Q: How can an alert call make a script run without error and without it doesn't ?

HoLyVieRI have a very odd problem with javascript. If you take the following code and run it, it will run fine without any error, but if you comment the first alert, it will throw an error at line 5 (var _board = Bomber.BoardFactory.getBoard();) saying BoardFactory doesn't exist (remember that with the f...

If anyone can figure this question out, you're a god.
 
if i run it through jslint, and fix the errors, then it works fine
yeah
the alert is doing automatic semicolon insertion for you
if you take out the alert then your Bomber.Game function is immediately executing
because the next character is a bracket
example:
var fnc = function(a){
    alert(a);
}/*;*/
//alert("hi");
(function(){
    return "OH SHIT";
}());
without that semicolon it thinks you're running fnc, and passing in function(){return "ohshit";}()
 
Hum, I just saw that
Thanks, that fixed it.
 
make sure you stick a semicolon after any var x = something; statements
even var something = function(){}; ones
 
ya, I'm used to do, but for function declaration, I often forget
whats that tool you where using to fix code again ?
 
3:29 AM
jslint
i was using jsfiddle.net which has a jslint button, but there is also a website for it
and i believe IDEs and stuff have it too
 
kk, I'm saving that im my bookmark.
 
jslint.com is the real one... it's pretty harsh
it will yell at you for (function(){})() because i think it's trying to start a (function(){}()) convention
mmm, 5 upvotes, yummy rep
one more and i hit the awesome 1k mark of yayness
 
You're probably gonna get it, it's on the hottest question now
 
yay! 1k ding
 
 
1 hour later…
4:46 AM
FUuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuccccccckkkkkkkkkkkkk
eval() was exactly what i was looking for. Thanks for taking the time to answer my question. – John
 
 
4 hours later…
9:04 AM
Good morning @Nathan, @jon3laze, @Shikiryu, @Tek, @drachenstern, @TimStone, @oraclecertifiedprofessional, @MichaelAngstadt and @SukumarRamadugu and anyone who enters soon!
 
Morning!
Can someone please have a look at edit 3 in this link? stackoverflow.com/questions/4818019/…
 
9:31 AM
weird.
 
I can't understand why that would fix it
 
Ab
9:50 AM
in html5 canvas, i'm trying to resize the canvas dimension but after resize the canvas content is lost
it becomes blank
 
@Ab do you have a link?
 
 
1 hour later…
Ab
10:57 AM
not, its a background image of 380 height / 1900 width that i would draw on the canvas
depending on dimension of its parent div, i need to create a canvas and draw that image
say parent div is 400 height by 500 width, shall i need to do something like this
idea is to best fit the canvas containing the image to parentDiv
actually ignore last messages , its more of logical question than a javascript query
 
11:13 AM
ohai
 
11:28 AM
0
Q: how to access a function inside the javascript file?

Prateek Rajhi everyone, i'm trying to access a function inside the js file wen a button is clicked how to access it? here is my html and also the code of the js file.... HTML: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Picker...

can anyone please help me with that
???
 
Tek
12:16 PM
@Greg Morning. I was here but just working. :P
 
in The Tavern (General) on Meta Stack Overflow Chat, 2 mins ago, by Yi Jiang
contemplates sending some of SO's HTML to CodeReview.SE
 
-1
A: jquery trapping allow only letters

RaynosSee here We bind to input change then take a look at the current string. We walk over the string and append any alphabetical characters to the output variable and return that. $("#textField").bind("input", function(event) { var out = ""; var str = this.value; for (var i = 0; i < st...

Am I missing something that's obvouisly wrong with that?
Also is anyone in here based in australia?
 
wonders why @TimStone is lurking here but not in the Meta Tavern
 
Ab
1:04 PM
need help finding out height of text in html 5 canvas
 
@Ab How did you get the text there in the first place?
 
Ab
well filltext()
say context.font = 1.5em
 
@Ab em heights are calculated relative to the surrounding text
 
Ab
i have to position an image leaving a space above it which is for text height
text height specified would be changable by client
yes
so i can find that out before passing on to canvas
i'm still not clear how to find height of text thats specifed in em
 
@Ab Roughly, n em = n * text-size of parent
 
Ab
1:09 PM
i have a parent div of variable size that would hold canvas
@YiJiang whats n
thanks got it
where do i know text-size
 
Why not just use px size for the canvas text
then you will always know the height.
 
Ab
the spec calls
i know
if only life is simpler on fridays
 
is the image on the canvas with the text, or is the canvas above the image althogether?
 
Ab
i bet is there as way of knowing inherited text-size...i can do the math in my script block before calling canvas method
well the canvas would hold a image with some text on top and bottom
 
ah ok gotcha
 
Ab
1:13 PM
i have to pass the parentdiv's dimension to create a canvas , then draw image, position so that there remains enough space above and below
for text
 
and the text has to be of variable size, depending on the image i take it
 
Ab
yes,#
here's how i call my code from html
var xyz = new XYZ('parentdivid', 'canvasid',optionsDictionary)
the options array holds the fontSize and other params
 
1:45 PM
what's everyone's view on Chrome's web store?
personally, I don't get it ...
 
@Greg Neither do I
The interface is pretty slick, but most of the applications are just... links to the actual webapps
 
I would understand it if they called it "bookmarks collection"
I don't understand why they call it "installing" ... when all it is is making a bookmark on your new tab page?
 
Just another AppStore
 
I think the appstore is cool because it gives devs a way to monetize some canvas games better
but other than that.. meh
 
2:06 PM
you mean, its just free advertising for your already existent applications?
 
hi people!
who can help me, i want to know what function would better to use
 
@user568975 for what?
 
phpjs.org/functions/unserialize:571 this or function for decoding json?
Greg i creating ajax app
 
@user568975 look at json.org
 
Ab
2:24 PM
how to create span element and set styles
 
?
 
Ab
i have a div with id='container'
to create a child element..a say a span with id='tempSpan'
 
4
A: Obfuscated FizzBuzz Golf

HoLyVieRJavascript 97 chars - no numbers at all Numbers ? Who needs number when you have Javascript ! a=b=!![]+![],a--,c=b+b;while(++a)e=!(a%(c+c+b)),alert(!(a%(c+b))?e?"FizzBuzz":"Fizz":e?"Buzz":a); Note: There is an infinite loop that will alert you the sequence. Bonus (747 chars) No number Almo...

Some people are crazy... Seriously.
 
@Ab document.createElement("span")
 
Ab
var s= document.createElement('span');
s.setAttribute('id','tempspan');
s.innerHTML = 'M';
var parentDiv = document.getElementById('parentDiv'); parentDiv.appendChild(s);
 
2:31 PM
@Ab parentDiv.appendChild(s);
 
Ab
would this work in IE aswell
i mean any browser issues
 
pretty sure that's standard javascript and will work across all browsers
try it
 
Ab
to remove..
dont i need to check if it exisits
i mean shouldnt id be unique
 
Ab
hehehe
doesnt say how to check if element exists
dont want to overwrite some other element with same id
 
2:35 PM
it does on the rest of the developer.mozilla.org/En/DOM website
 
Ab
i woud rather thorw exception
 
@Ab if(!document.getElementById("someId")) { alert("nothing here..."); }
 
Ab
:) thanks
 
is it possible to use web sockets for peer to peer connections ???
 
2:51 PM
it is so tough to answer a javascript or web question. first you gotta understand the requirements, but then once you propose some prototype answer or something that requires feedback, people vote it down even before you can strike a conversation. how do you guys survive, im feeling so frustrated since past 2 days :(
 
Im very very careful about posting answers basically, and am quick to delete my own :P.
 
Ab
is it good idea to create a span just to find out how many px is 1em
i created a span, added text 'M', and checking OffsetHeight
 
i don't think answers are meant be given at one shot, unless ur some expert guru. i believe q&a is to and fro process unless they have a text book answer
 
Ab
help help
 
3:36 PM
@ab what is the pages font-size set to? If its just default then its 100%, and 1em should be 12pt, which is like 16px.
if its 62.5% then 1em is 10pt, which is what like 12-13px?
aww he left
 
4:18 PM
Wow, time for another code-bowling challange... What to do...
 
Nah
 
Why not ? Bringing code-bowling there could be nice.
 
I don't have beta access
next week
Hrm, so what problem can we come up with
 
I do have access there.
\o/
 
4:24 PM
@Ivo: Where are you?
 
can anyone advise me on why I can't make things bold/italic if I edit this more than once? jsfiddle.net/g105b/gbFdh
 
because of $(styleEl).remove();
i removed it and it works
 
@Loktar :\ still can't re-edit the style after a save...
 
really? I could..
weird
sigh now i cant.. wonder if i pasted the wrong link
Just change $(styleEl).animate(
{ height: "0" },
100, function() { });
forgot to hit updatge
*update, should work now
 
@Loktar thanks, I wonder why I decided to remove the style element ...
 
4:36 PM
thats what I was wondering :P since it works perfectly even if you dont remove it. Just needed another set of eyes i guess.
too bad it wasnt an so question, i could of gotten some rep out of it
 
@Loktar sorry, didn't seem a big enough question
 
haha its no big deal
i would of been beat to the answer anyway
 
4:57 PM
This day sucks
First nearly no sleep
Then really bad dreams
Weather sucks too, oh and it's winter.. I hate total darkness around 6pm
 
How do people handle automated client side testing? and not having test code in production websites?
@IvoWetzel good morning
@Ravikiran I know what you feel. have an answer which I interated into a great answer but its still -1.
 
@Raynos Morning?
 
@IvoWetzel I presume you just woke up
 
think about bowling
We need a challenge for today
 
I'm hardly able to type... and you want me to think? ><
Don't do that, or you'll get another programming language that's like BASIC
 
5:21 PM
yes
 
Wtf?
Who's posting pictures of dead kittens?#
 
@ircmaxell What about a sorting algorithm or maybe an even simpler algorithm
 
Simpler
 
generate a random number
(XKCD links not allowed)
 
interesting
 
5:32 PM
What about a small Guessing program
 
iterate over an array
sum an array of numbers (variable number of)
 
You think of a number between 1 & 100 and the program has to guess with the user replying with higher/lower
I guess that's far too complex
sum: [array] -> [int] is a better option
 
yeah, from the Encryption bit, the simpler the better
just summing was done last week
What about a prime number seive?
Hrm...
Sorting algorithms is interesting
 
The higher the O the better...
O(O^n) ???
 
wow
 
5:38 PM
O(O)
make it recursive!!!
O_O
O.O
 
Ahhh
compute the circumference of a circle given the radius
You could go nuts if you wanted to with that
 
6:19 PM
@IvoWetzel >_< O(O). is O(o) possible?
@ircmaxell just get the program to calculate pi to infinite accuracy and never halt :P
@ircmaxell what about calculate e
 
355/113
More then enough precision for me
 
@IvoWetzel you think your sunset is early in winter?
thinks about code golf ideas
 
-1
Q: Is ++i really faster than i++ in for-loops in java?

BinabikIn java I usually make a for-loop like following: for (int i = 0; i < max; i++) { something } But recently a colleague typed it so: for (int i = 0; i < max; ++i) { something } He said the latter would be faster. Is that true?

 
-.- People ask taht question too much
In assembly ++i is faster then i++
 
It's pointless to ask such things in any jitted language
0
Q: Retrieving value of JSON variables

lolwutI have a JSON object which is generated from my website, however I need to know how you can get a JSON variable in each value, e.g. var json = '{"item":"one","item2":"two","item3":"three"}'; var js = eval('(' + json + ')'); for(var i in js) { alert(i); } This will return item, item2, ...

who wants to rant about eval?
I'll throw in the usual complains about the missing hasOwnProperty for free
 
6:38 PM
@IvoWetzel hasOwnProperty is optional. for in loops are safe without it. Instead I shoot anyone who uses Object.prototype
 
tell that anyone who has prototypejs on their site :P
 
@IvoWetzel I don't use noob 3rd party code. Tbh the new Prototype 1.7 is good. It doesnt overwrite native prototypes
 
I know, they finally came to mind
 
Is it time to link stuff from javascript weekly that everyone else has already read?
 
@Raynos Just saw that one... looks great, but I have no chance of moving to Frankfurt atm :/
 
6:51 PM
@IvoWetzel I assumed germany had radius 20 km
 
That'd be great... but sadly it isn't the case
Frankfurt is around 100km away from my place
 
@IvoWetzel 2hour commute :) you don't really do anything anyway. Just spend that 4 hour commute coding on the netbook
 
Make that 3 to get to the next train station first...
 
>_<. Do you really live 3 hours from a train station?
 
that's a total of 6 then
No, around 1 hour
 
6:58 PM
Ah ok
 
Because those stupid buses need that long for 20km
Driving through every single village in the area... stopping every 2 minutes or so
 
Buses are horrible.
 
I know :/
 
What do people think of addyosmani.com/blog ? Is there any reason to think the stuff he says is bad?
 
7:28 PM
@Raynos he seems very self opinionated, with no citations to back up his statements
and instantly annoys me with "Hey Guys" on every post
 
hi
 
@Greg Well, considering the fact that I only have 800 vertical pixels here, 4/5th of his front page are self promotion
And I already have stripped down my FX menu to two bars...
(and there's not even a statusbar in FX4...)
also, why does clicking the header only work with JS enabled?!
 
You could also hate Osmani for his "18,009 Followers & Fans" if it's higher than your favorite success metric, like SO rep, or salary, or whatever.
 
haha :D
 
I can't stand tutorial videos or screencasts for most things, but I have some coworkers who don't like to read or write and this could be more accessible.
 
7:37 PM
I jumped through one of his screencasts on vimeo, looks good
Although he could disable the spell checker when recording the presentation :P
 
What was in that Crockford talk I was just watching yesterday? "JavaScript is a language that most people don’t bother to learn before they use."
 
@IvoWetzel @Greg but just look at him! This guy is like cool and hip!
 
@Nathan Well, he's right
 
@Nathan screencasts are cool. Watching someone talk about his code whilst he hacks around with it in vim is neat
 
is it possible for a js element to be attached to the DOM, yet not rendered?
 
7:40 PM
@Raynos True. I've also seen some first-rate video tutorials for things that need visuals, like Photoshop. But generally I prefer to read about code.
 
@user26270 yes css: display: none
 
@user26270 there are always lots of DOM elements that aren't rendered, like in the <head> section for instance.
 
@Nathan I like watching ryan dahl talk about node.js :)
 
@Raynos link?
 
well, I'm working with GWT and am adding widgets in the onLoad() method, and then immediately checking their position to add other elements relative to them, and their x/y are coming back as undefined;
I know there's a little black magic between GWT and JS but this was the chat group closest to what I wanted to ask
 
@user26270 if they have x& y then there visible or at least visibility: hidden. For objects in the DOM to have x & y then they need to consume physical space in the DOM
 
watches
 
x and y are undefined, based on the results; so I guess a better way to ask is: why are x and y undefined, after being attached to the DOM?
 
can you see it? is the DOM ready?
 
7:54 PM
yes, I'm assuming the DOM is ready because other parts of the page are visible; I'm using RaphaelJS; the problem happens on a refresh; the first time, I add the raphael 'canvas'/component to the page, and then draw all the objects on Load(), and it works like a charm; but when I want to refresh the canvas, I basically remove the old one, add a new one, and do the same, but the 2nd time the positions are screwed up due to the undefined x and y
 
@user26270 donr really know sorry. replicate in a jsfiddle and ill look
Opinions on backbone.js please
 
what is a jsfiddle?
5
 
user492203
Hi there! :)
 
@user26270 jsfiddle.net
 
user492203
@user26270 jsFiddle is a site where you can experiment with HTML, CSS and JavaScript. You can save your “fiddles” and share it with other users, too.
 
00:00 - 20:0021:00 - 00:00

« first day (104 days earlier)      last day (4860 days later) »