« first day (552 days earlier)      last day (4403 days later) » 

12:14 AM
0
Q: Staggered Isometric Map In Javascript

MrGoodbyteI'm trying to create a staggered isometric map in Javascript. var x, y, row, column, top, left, width = window.innerWidth, height = window.innerHeight, tile = {width: 64, height: 32}; row = Math.ceil(width / tile.width); // how many rows will be in map column = Math...

 
 
1 hour later…
1:14 AM
0
Q: Collapsible menu and amount of links in a web page

DanielOne of my pages contain three levels of a collapsible menu (JS + CSS from mycssmenu.com). There are a dozen first level items displayed to users, each one with various second level items, and finally a lot of third level items, each one containing a related link. This generates a lot of internal...

 
 
4 hours later…
5:32 AM
0
Q: Installing and running browserquest on ubuntu

Ersel AkerI have installed node.js and necessary packages to run browserquest. I have started the browserquest server, which is running on port 8080 and when I go to my browser and type http://localhost:8080/status I can see that server is running and currently no clients are connected. I build the client ...

 
 
2 hours later…
7:25 AM
@Esailija: just FYI, remember yesterday I got serial downvoted then serial upvoted? Today, I got "serial upvoting reversal" from some admin :-) nothing about serial downvoting reversed though :D
 
7:49 AM
@Raynos: what was this full js html5forms shim you found? Can't get it back...
 
o/
 
Hello guys
 
hi
 
How would you approach an implementation of an "onchange" event for javascript objects (not dom elements)?
 
8:01 AM
maybe a setter-function?
 
Getters/setters are fine... but sometimes I would like multiple operations to be treated as a single event.
 
and changes to the object are only made over it
 
I was thinking about transactions or "isSilent" parameter on setters, but is there a better approach?
 
hm, okay. you could split up the arguments-object in the setter - function to treat more arguments and operations accordingly, triggering one "event"
but I don't know if this is a good approach for doing this
 
I guess I'll post a more complete question on so.
@GNi33 Yeah, I was thinking about that too, but somehow the idea didn't stick.
 
8:04 AM
@Oleg: maybe you can find what suits you here developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…
with get/set/enumerable/configurable
 
@FlorianMargaine looking at it
 
it's ES5 tho, so you'll need some shim if you want it working on older browsers
 
8:21 AM
you can't shim defineProperty
gist: unshimmable subset of ES5, 2012-01-23 19:03:18Z
The following features of ES5 _cannot_ be shimmed.

## The ones you care about 

### Enumerable properties [ES3]

Using `Object.defineProperty` if you define a non-enumerable property on an object then `for..in` loops over that object will behave correctly in modern browsers but enumerate over that property in legacy browsers. 

This means that code that works in modern browsers, breaks in legacy browsers.

[Stackoverflow does not know how to fix this yet][1]

[Although a partial solution is possible][4]

### Getters and Setters [oldIE (IE8 works for Host objects)]

There is no generic way to emulate Getters and Setters in oldIE. There are ways of emulating getters and setters in IE abusing VBScript but not in a way that is compliant with `Object.defineProperty`.

This requires more research as per [issue 91][3]

## The ones you don't care about

### Strict mode [ES3]

Strict mode will throw errors on compliant browsers when you use the "naughty" parts of ES5 non-strict. It will not cause divergent behaviour on legacy browsers. 

This means that as long as you test all your code on one modern browser you get all the benefits of strict mode and it being a no-op on legacy browsers has no side effects that you should care about.

### `Object.getPrototypeOf` [oldIE]

This method cannot return the correct value in legacy browsers if you destroy the `Fun.prototype.constructor === Fun` link. As long as that "connection" is there, this function will be well behaved. If this link is broken then that's a bug in your code you should fix. This means that in _sensible_ source code `Object.getPrototypeOf` is safe.

### `Object.getOwnPropertyNames` [ES3]

Is the same as `Object.keys` on legacy engines. There is no way to get non-enumerable properties other then _knowing_ their keys. This isn't an issues outside of host objects as there are no common non-enumerable properties on objects you want to get a hold of as an array.

### `Object.isSealed`, `Object.isFrozen`, `Object.isExtensible` [ES3]

They all return the true value, but they aren't very useful.

### `Object.defineProperty` / `Object.defineProperties` [ES3, however writable is only broken in oldIE]

The `writable` and `configurable` flag have no effect in legacy browers. Again however as long as you test in modern browsers it will throw the exception. This means that the no-op in legacy browsers is harmless.

Note that getters and setters as mentioned above are unshimmables that you should care about (and avoid if you want oldIE support)

### `Object.seal` / `Object.freeze` / `Object.preventExtensions` [ES3]

Another set of methods that will throw exceptions as long as they are tested on modern browsers. This means that they are safe and harmless no-ops on legacy engines and you do not care about that.

## The ones that can be shimmed but are not implemented by ES5-shim

### `Object.getOwnPropertyDescriptor`

This can be shimmed to an extend. But, ES5 shim is not compliant, See [issue #79][2]. 

  [1]: http://stackoverflow.com/questions/8918030/is-it-possible-to-emulate-non-enumerable-properties
  [2]: https://github.com/kriskowal/es5-shim/pull/79
  [3]: https://github.com/kriskowal/es5-shim/issues/91
  [4]: https://gist.github.com/1672142
dammit, i didn't want the chat to parse this :D
and the native get and set - properties are still pretty slow on all the browsers
 
Sorry, got distracted... at work atm.
 
@GNi33 arg :(
 
I'm probably misunderstanding defineProperty, but even setting older browsers aside, it looks like it doesn't help performing multiple gets/sets/updates in a single operation.
 
oh, that
well I guess using arguments to check if you have to emit the event or not is a good idea
 
@FlorianMargaine I do agree, it doesn't seem like a clean approach.
 
8:27 AM
it does*
 
Misread...
Why so?
 
it's an okay approach i think
 
It means every object modification method will need to have this argument.
 
no
 
@GNi33 hmm?
 
8:29 AM
if you don't pass it, it will be undefined and you can catch that
 
@GNi33 Oh, that? Yeah sure.
 
so you just have to pass it, if you want the "event" to fire, or the other way round
 
So you would not recommend playing with a transaction approach?
 
playing with different approaches is never a bad idea
depends on how much time you want to spend on this ;)
 
Something along the lines of: o.startTransaction().doA().doB().doC().endTransaction();
@GNi33 Good point.
 
8:42 AM
did i already mention that i hate templating for emails? yes? so what, i'll say it again
Coding your template like it's 1860! YAY!
 
Tables are good friends again? :)
 
i hate them
and i hate inline-styles
so, every-time i get to do a newsletter-template, something in me dies ;)
why is stackoverflow using tables?
 
@GNi33 Where?
 
on most of the markup
look at a question
 
The input area of this chat is a table. Basically, the entire footer with the gravatar in it.
 
8:53 AM
RT @paul_irish: One-page summaries of what is new in ES5, ES6, DOM4 and XHR2 https://github.com/espadrine/New-In-A-Spec /by @espadrine
 
Hi all, I would appreciate if someone could take a look at this question: stackoverflow.com/questions/10232248/…
 
@RammtinAvar tried to use css-transitions?
could set a transition on opacity on hover
with a javascript - fallback of course
 
hmmm I have never done that before
 
it's pretty straight forward
 
No Internet Explorer support though afaik.
 
9:06 AM
that's right
 
Thats no problem, my project is not for IE users :)
 
haha, then use css-transitions
 
the css for the nav is to hardcoded for me to be able to do anything :/
 
9:42 AM
hello.
i am trying to recursively parse several json files and having trouble.. can anyone help?
@GNi33 can u hlp?
 
10:06 AM
I have a function that is called by window.onload function and click event of an element. The function is regarding changing innerHTML of some div tags. The innerHTML gets changed only on window.onload but not on the click event. I can't understand what is the issue. And, I cant find any appropriate topic so that I can post this on forum.
 
@subhojit777: provide the event handler code
 
@j
@jAndy
@jAndy whats that? can you explain?
 
@subhojit777 He wants to see your code.
 
@subhojit777: we need to see the code from the function which is called on onload and for the click event handler
I dunno how I can further explain 'event handler'
 
@jAndy ok
 
10:15 AM
0
Q: How can i count all the DOM changes and dynamic function calls in a page using userscript

Sindhui want to measure the number of function calls that are used to dynamically interpret JavaScript code (e.g., eval and setTimeout), and the number of DOM changes that may lead to executions (e.g., document.write, document.createElement). I want to perform this activity using userscript. With the h...

 
Wikipedia can help :)
http://en.wikipedia.org/wiki/Event_(computing)#Event_handler
 
guys, you need to upvote this: stackoverflow.com/a/10244255/851498
people are starting to trust the client because it's getting powerful ._.
 
@FlorianMargaine "data" is already plural in English :P
 
uh? i've always used datas
and noone has every told me that
 
@jAndy heres the code jsfiddle.net/HZSQ5
 
@FlorianMargaine In French "données" yeah, but in English "data" is a plural of "datum", so you can't say "datas". It's uncountable. en.wiktionary.org/wiki/data#Noun
 
@subhojit777: jQuery expects strings as selector, if you pass it a variable, it will look for the string in this variable
 
Sorry for being annoying, I'm just so bored here :)
 
@subhojit777: jsfiddle.net/HZSQ5/2
 
@Oleg: nah it's okay, nice to know
 
10:25 AM
check that please, I basically just corrected some error so far
 
@jAndy: you're late :p
oh wait, my bad
 
@FlorianMargaine: I don't think so
@FlorianMargaine: you didn't fix all errors :p
 
which is why i said "my bad" :p
 
@FlorianMargaine: oh well :p
@subhojit777: jsfiddle.net/HZSQ5/4
@subhojit777: looks like you don't wrap your event handler/node access into any kind of DOMContentLoaded event. jQuerys .ready function will do it there
 
its not working. if you click on the button the console is not updated. but if you click on "Run" the console gets updated since its window.onload
 
10:29 AM
@subhojit777: get the second link, it does work there
 
10:44 AM
@jAndy thanks! but I am still getting the same issue on my website. anyways, I will review my code. But, I am not getting what was the problem. And, how it was solved by adding $(function() {}); to the code.
 
@subhojit777: $(function() {}); is only a shortcut for $(document).ready(function() {});. Anything within that handler is executed as soon as the DOM is loaded and ready so you can deal with it (like querying nodes and add event handlers)
you actually should always put your jQuery code into such a construct when dealing with the DOM
 
Anyone interested to earn 50 bounty by answering my question? I will add the bounty tomorrow. stackoverflow.com/questions/10232248/…
 
so I guess I'll wait till tomorrow :p
 
 
1 hour later…
11:57 AM
RT @erikdahlstrom: 7 reasons to consider #svg instead of canvas - http://www.sitepoint.com/7-reasons-to-consider-svgs-instead-of-canvas/
 
Any suggestions to change inner text from a div without using innerHTML ?
 
Yup, and innerText for IE < 9 I believe.
 
yea
 
12:12 PM
Hm, interesting, I was searching a bit of the innerHTML and isn't a DOM method right ?
 
@Andredseixas What do you mean?
 
if ( 'textContent' in el ) el.textContent = text
else el.innerText = text
 
ok.. I may change my view on downvoting
0
Q: Reset a Checkbox Field Clientside

DoNNie_DarkOI have a checkbox control and a reset button on a web page. I want the chekbox to be unchecked whenever the rest button is pressed. This should be a clientside process. How can i achieve it? can it be done by using document.getelementbyID()?

 
innerHTML is a string..
 
oops
of course someone is like "use jQuery!"
 
12:14 PM
I don't know.. Just too many people complaining about innerHTML
 
$("#chkYes").removeAttr('checked');
sighs
 
@Andredseixas What's wrong with it?
 
@Oleg stop pressuring me :( Read it here, this websites gives some examples why it's bad. slayeroffice.com/articles/innerHTML_alternatives
 
the "faster" doesn't apply anymore tho
 
why?
 
12:19 PM
hehehe dom methods kick it's ass speed wise
 
It's not bad. It's just one of the many hammers you use to get the work done.
 
Hey there
 
it's like driving a car into a scew to try to get the drywall to stick.
 
hey @Abhishek
 
Sounds legit.
 
12:20 PM
for a begginer, hammer is not an option to do stuff. I want to learn the best practices. I can hammer a lot of stuff into the code. But I really don't want to.
 
@Loktar whats up ?
 
@Abhishek o/
 
eh not much just raging at the overuse of jQuery :P
 
Apr 12 at 15:21, by rlemon
I'm a carpenter.. I got a new type of hammer today. I already know how to use it. In a week of using it I will be 10x more efficient with using it. Now you, (not carpenter) get the same hammer. You don't know there is a difference between hammer functions, you use it, it works kinda, not really, ouch my thumb.
I hope the analogy makes sense
if it doesnt this is probably more your speed
Apr 15 at 17:33, by Incognito
user image
2
 
turdQuery! :D
 
12:22 PM
@Loktar: I think that's one of my favorites answer on SO :p stackoverflow.com/questions/10230451/… it's unfortunate @rlemon added some jQuery tho :3
 
then rollback :P
 
@FlorianMargaine yeah I upvoted that )
I like the [].foreach method
although requiring the empty [] makes it look a bit hacky
 
Array.prototype.forEach
BAM
 
@FlorianMargaine \o
 
@rlemon: longer to write
 
12:23 PM
$.each(..,function(){});
 
oh wait
that's not the answer I meant
 
@FlorianMargaine more semantic.
 
@rlemon: let's use something like forEach = function(){}.call.bind( Array.prototype.forEach ) and be done with it
 
<troll data-level="extreme"> jsperf.com/vs-adotp </troll>
^ 8% makes all the difference!
 
12:29 PM
<troll data-level="extreme" data-rage="full /> now thats what u did
 
@rlemon: yeah, especially when the slowest can do it over 5 million op/s :p
 
i need to buy a new computer
and this is what i am making
 
@rlemon i find both ways to look extremely ugly :P
but the [] - one is just....
 
@GNi33: this is why @Raynos made this: github.com/Raynos/NodeComposite
 
intel i7 - extreme
8 Gigs ddr 3 ram ,
250gig SSD with my old and faithful 500gig External HDD
An AMD Radeon™ HD 6990 Graphics Solution

Simple Logitech Multimedia Keyboard and mouse .. | hah had to specify
so something i am missing or forgetting ?
 
12:33 PM
a motherboard :P
 
ah yes (XD)
whoops forgot..
motherboard is a fairly low Asus :-(
 
how much do you spend?
 
Hulk Smash Puny Asus!
 
My Pentium 4 with 512 MB RAM will leave you in the dust.
 
lol
 
12:35 PM
@FlorianMargaine hmmm...
 
Programming drives me to the drink..
 
@GNi33 in indian money its costing me about 67,000 /with discounts/
 
@rlemon lols
 
12:36 PM
HULK SMASH
HULK Belly Hurt
 
LMAO!
 
lol
 
I want to get that for my kids
"see hulk gets scared too"
 
looks like Hulks taking a Smash
 
12:37 PM
haha yeah exactly cracks me up
how didnt the artist realize the hulk is shitting bricks?
 
my grilfriend says I fall asleep at the computer desk too much...
 
lol nice
 
and last but not least... possibly one of my favorite builds of all time...
 
lol
 
@rlemon .. wait ,, that was wrong ..
=/
 
@rlemon RAAAAAGGGEEEEE
 
@rlemon what about this one ?
 
lol
 
@Abhishek wait, you want to buy a pre-assembled pc?
 
12:41 PM
@GNi33 ahhh the good old days of blowing in your cartridges to get them to work again.
 
good old? i'm still playing on this badass!
zelda ftw!
 
8bit graphics no longer titillate me
 
@GNi33 noh
i am just giving rleamon some more food to eat :D :D lolz
 
okay ;)
 
@GNi33 link to the past ftw
however that gold cartridge did make me feel kinda like a boss.
 
12:43 PM
i know what you mean ;)
 
haha that tie fighter desk is amazing
 
but i want to get my hands on an c64 again
those were good times
 
@GNi33 I still have mine :)
 
VirtualBoy - that is where it is at!
 
Ive got 2 of those
 
12:44 PM
send me one! :D
 
for anyone who doesn't know.
3D before 3D was cool
  The was a video game console developed and manufactured by Nintendo. It was the first video game console that was supposed to be capable of displaying "true 3D graphics" out of the box. Whereas most video games use monocular cues to achieve the illusion of three dimensions on a two-dimensional screen, The Virtual Boy creates an illusion of depth through the effect known as parallax. In a manner similar to using a head-mounted display, the user looks into an eyepiece made of neoprene on the front of the machine, and then an eyeglass-style projector allows viewing of the monochrom...
 
my son playing on my commodore
its a c128 which is a bit newer than a c64
 
@rlemon hipster 3D? ;)
 
but it goes into 64 mode
 
@Loktar nice! :)
 
12:45 PM
@Loktar: man, how old is that keyboard?
 
haha over 20 years
 
kik
 
the plastic is yellowing
I think the c128 came out in 85 or so
yeah 1985, so 27 years..
 
show me this (working) and ill be impressed
|discontinued = |CPU = None |controllers = Two paddles |unitssold = 330,000 |topgame = |successor = Magnavox Odyssey² }} The Magnavox Odyssey is the world's first home video game console. It was first demonstrated on May 24, 1972 and released in August of that year, predating the Atari Pong home consoles by three years. The Odyssey was designed by Ralph Baer, who began around 1966 and had a working prototype finished by 1968. This prototype, known as the Brown Box, is now at the Smithsonian Institution's National Museum of American History in Washington, D.C.. In 2009, video game ...
why does Wikipedia not show all of the nintendo system flops. en.wikipedia.org/wiki/Nintendo
 
/t
 
12:57 PM
hello
 
@rlemon coz wikipedia expects you to add the missing flops :)
 
@Linus hello
 
can some one hlp me with this.. can i pass an aurgument to refer to JSON data array?
 

« first day (552 days earlier)      last day (4403 days later) »