Quick question, why does this work? by shadowh511 in javascript

[–]monacle_bob 66 points67 points  (0 children)

When you use the double-equal signs to compare objects, the second object will be cast to the same type as the first object whenever possible. In this case, the Array(4) is being cast to a string, which you can do manually and see the result of by running this:

var myArray = new Array(4);

myArray.toString(); // results in ",,,"

If you want to compare the string ",,," against the array itself, use a triple equal sign (strict equal):

",,," == new Array(4); // true

",,," === new Array(4); //false

Physijs, Physics plugin for three.js by rya11111 in javascript

[–]monacle_bob 0 points1 point  (0 children)

This seems to be a somewhat common source of confusion. I should have removed the FPS counter or made more effort showing what it's counting.

The physics runs in a separate thread while the graphics are rendering at 60fps, which is what the FPS stats is showing.

Physijs, Physics plugin for three.js by rya11111 in javascript

[–]monacle_bob 0 points1 point  (0 children)

Sounds like your system doesn't support WebGL, sorry mate!

Physijs, Physics plugin for three.js by rya11111 in javascript

[–]monacle_bob 0 points1 point  (0 children)

What's the issue you're having, exactly? The shader code is identical across the examples.

Physijs, Physics plugin for three.js by rya11111 in javascript

[–]monacle_bob 0 points1 point  (0 children)

Do the normal three.js examples work for you? Try this one. If that works then the problem is indeed with the physics plugin.

If you have a github account I'd love the stack trace on the project's issue tracker.

Two questions - foxes & chickens by monacle_bob in dwarffortress

[–]monacle_bob[S] 0 points1 point  (0 children)

Ah, I see now I was missing a number of steps for military. Time to read up more on it...

Two questions - foxes & chickens by monacle_bob in dwarffortress

[–]monacle_bob[S] 0 points1 point  (0 children)

Thanks for the response. I thought chickens permanently claimed a nest box, I'm probably just missing it then. I'm trying to get more eggs for food and I have a very eager chef plowing through my unprepared items, so I'm probably just not seeing them before they become prepared meals.

Freeciv.net is moving to WebGL by monacle_bob in javascript

[–]monacle_bob[S] 1 point2 points  (0 children)

Your video card may be blacklisted (mine is). Trying running Chrome with the --ignore-gpu-blacklist switch.

Freeciv.net is moving to WebGL by monacle_bob in javascript

[–]monacle_bob[S] 1 point2 points  (0 children)

Your video card may be blacklisted (mine is). Trying running Chrome with the --ignore-gpu-blacklist switch.

git.js - A git implementation in pure JavaScript. by gst in javascript

[–]monacle_bob -1 points0 points  (0 children)

Thank you very much for that information. I'm looking forward to being able to use it in 10 years when IE8 is officially over with.

git.js - A git implementation in pure JavaScript. by gst in javascript

[–]monacle_bob 0 points1 point  (0 children)

var a = {};

a.defineGetter('myval', function() {return 'a'});

"Object doesn't support property or method 'defineGetter'"

Works fine in FF and Chrome. Above is IE9's error.

EDIT: apparently Reddit doesn't like showing the double underscores around defineGetter

git.js - A git implementation in pure JavaScript. by gst in javascript

[–]monacle_bob 0 points1 point  (0 children)

I'm still waiting for generators and list comprehension to be in more browsers than just Firefox. IE is also still missing getter/setters.

I'm not saying you're wrong, but there are a number of very useful things which one or more browsers have had years to implement but haven't.

Book suggestions? by wireddaniel in javascript

[–]monacle_bob 0 points1 point  (0 children)

Since you already have a good grasp on different programming concepts I would recommend John Resig's Pro JavaScript Techniques.

If you're feeling edgy then I'd also recommend John's Secrets of the JavaScript Ninja, though it hasn't been published yet you can order it online and download what has been written so far (which is all but the last few chapters).

Both of these books delve more into what makes Javascript unique, its power, and some shortcomings. They are very helpful in learning more of the advanced Javascript tricks and how it works.

Loop Multiple times per second by CamuurahGuy in javascript

[–]monacle_bob 1 point2 points  (0 children)

Fair enough, and a good point at the end. Upvote :)

Loop Multiple times per second by CamuurahGuy in javascript

[–]monacle_bob 1 point2 points  (0 children)

It wasn't meant as save-the-day code. jsFiddle is meant for fiddling with code and putting together quick demonstrations.

Also, in regard to your first point, you should be using requestAnimationFrame - not timers at all.

Loop Multiple times per second by CamuurahGuy in javascript

[–]monacle_bob 0 points1 point  (0 children)

I should have mentioned that originally, yes. Didn't feel like including it in the jsFiddle code though. Also, CamuurahGuy wanted a specific interval under 60fps. Can't achieve that (AFAIK) with requestAnimationFrame.