« first day (536 days earlier)      last day (4398 days later) » 

12:05 AM
any gurus know about this one?
2
Q: On Render Callback For G+ Button

Michael RobinsonHow might I go about performing an action only when a G+ button has finished rendering? Facebook allows one to do this using the following: FB.XFBML.parse(document, function() { alert('rendering done'); }); I've perused Google's documentation, but didn't see anything helpful. Current Wo...

 
GGG
12:56 AM
whoa
the mouse actually woks great in vim
:set mouse=a
 
1:33 AM
GEvent.addListener(map, 'zoom_changed', function() {
alert("You before Zoomed the map.");
});

anybody can help me with this, why this doesnt display a message when i change zoom level?
 
1:50 AM
anychance anyone has any comments to make stackoverflow.com/questions/10001681/…
 
Hi there
?
 
i am new to this chat group?
can i post any questions here regarding css?
i need help on this question
1
Q: How to abbreviate the long Selenium CSS code for table elements?

seleniumloverI am having trouble abbreviating the following selenium CSS code which has the element inside multiple tables. The code below gives me two checkboxes. table[id$=gridReports]>tbody>tr:nth-of-type(2)>td:nth-of-type(2)>table[id$=panelReportInformation]>tbody>tr:nth-of-type(2)>t...

can anyone help me on this?
 
2:34 AM
0
A: How can I wait for set of asynchronous callback functions?

RaynosUse an control flow library like after after.map(array, function (value, done) { // do something async setTimeout(function () { // do something with the value done(null, value * 2) }, 10) }, function (err, mappedArray) { // all done, continue here console.log(...

@tblobuam I absolutely love after.map thanks :)
 
3:34 AM
RT @mattwkelly: Ringmark is now open source. http://bit.ly/H6qBAT Props to @rwaldron, @boazsender, @ajpiano, @tobie
 
 
3 hours later…
6:16 AM
HI ALL
 
RT @mozhacks: New blog post: WebRTC efforts underway at Mozilla! http://hacks.mozilla.org/2012/04/webrtc-efforts-underway-at-mozilla/
 
6:51 AM
hi
There is something I find weird... I guess it's more some syntax I'm missing but well, here it is: when I want to find out the type of an object (array, nodelist, etc), I usually do var obj = {}; obj.toString.apply(array) because {}.toString.apply(array) doesn't work. Why doesn't the former work?
it spits me a syntax error out :/
Okay. ({}).toString.apply(array) works.
 
 
2 hours later…
8:51 AM
o/
 
1
Q: How can I render player movement on a 2d plane efficiently?

user422318I'm prototyping a 2d HTML5 game with similar interaction to Diablo II. (See an older post of mine describing the interaction here: How can I imitate interaction and movement in Diablo II?) I just got the player click-to-move system working using the Bresenham algorithm but I can't figure out how...

 
9:25 AM
0
Q: Refactoring Javascript into pure functions to make code more readable and maintainable

CrimsonChinNote: I am very new to Javascript. The code I provided is long but not complicated. The code below works and runs fine. But I would like to seperate it out into logical 'pure' functions to make it clearer whats going on. I started to re-factor this myself and made some good progress, howev...

 
9:37 AM
user image
3
 
9:57 AM
Can anyone help me regarding html5 file api
 
10:26 AM
hello all
got a quick question, thought id try the chat room. i need "logic" help...i have an ajax call to a php file that gets posts from a db. Ajax is on refresh every 5 seconds to refresh for new content but...there has to be a better way. i was gonna try a while loop(reccomended elsewhere on here) but, what do i compare against?
how do i know that the last message is the last...and when its no longer the last?
thanks in advanced
this is the main thread that discusses where im at. stackoverflow.com/questions/9991336/…
 
 
2 hours later…
12:15 PM
@somdow Long Polling
- Make a request to the server
- on the server check for an update [ loop * ten, break on update found ]
- sleep 1 second in loop
- return update to the user
- start back at step one.
ajax is making calls as soon as the old call is completed.
server waits a few seconds to see if a new update is produced.
 
So you basically want to implement an event loop?
Hey there by the way. :)
 
lol hey
 
Is what I answered there actually what he asked?
0
A: Troubles getting CSS transition to work

Octavian DamieanI assume what you are looking for is the ease timing function. So your CSS rule should look something like this. .class { transition: property(ies) duration timing-function; } .class:hover { property(ies): new value; } For Opera you have to define the exact property. In your case it ...

Not quite sure.
 
12:31 PM
I hate making diagrams.
I can never figure out the tools for making them either.
0
A: Troubles getting CSS transition to work

rlemoncommented: Double team answer: jsfiddle.net/rlemon/WZTuM/4 here is an example of what @Octavian is talking about but with MUCH cleaned up CSS.

 
12:47 PM
hey guys, me again
i need some advice
 
pick up cooking
 
I've tried that already...
i have a div with id #prlogo
 
I hope you're used to our smart-assed demeanor
@Miro always easier to just show the code
 
i am... i'm a pretty good smart ass myself, but i need some advice, so i'm holding bac the ass bit!
 
"here is the code"
"here is what I expect it to do"
"here is what it does"
 
12:49 PM
i havnet actualy got any code yet... i just need some advcie
 
lol
conceptually what do you want to do
 
in the div, there is an image which changes (with ajax) without having to refresh the page
is there any way, yet again, to pick up the image file name and copy that into a text field?
 
yea
 
my problem is that i need it to copy every time the image changes
 
what code do you use to change the image?
 
12:51 PM
or, maybe, copy when i hover over the 'next button' on the form
 
javascript is pretty good at that stuff ;)
 
hold on... let me get the code
 
/* Little XHR
 * by: rlemon        github.com/rlemon
 * see README for useage.
 * */
var xhr = {
	xmlhttp: (function() {
		var xmlhttp;
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (er) {
				try {
					xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
				} catch (err) {
					xmlhttp = false;
				}
			}
		}
		return xmlhttp;
	}()),
	 /* github.com/Titani/SO-ChatBot/blob/… */
^ no jQuery ajax
 
this is the function
$(document).ready(function() {

$('#logo').live('change', function() {
$("#prlogo").html('');
$("#prlogo").html('<img src="../preview/loader.gif" alt="Uploading...."/>');
$("#logoform").ajaxForm({
target: '#prlogo'
}).submit();

});
});
the form which does the uplaoding is
 
@Miro are you new to web programming?
 
12:52 PM
<form id="logoform" method="post" enctype="multipart/form-data" action='../preview/logo.php'>
<input type="file" name="logo" id="logo" />
</form>
very unexperienced with php and javascript
 
css and html im ok with but php and javascript not at all
 
Am I right to downvote this answer? stackoverflow.com/a/10011170/851498
 
just a piece of advice, leave jQuery alone for the time being and learn some more fundamentals.
 
(for the reasons stated in comments)
 
12:53 PM
jQuery does a bunch of non-standard things and promotes bad coding practice.
Every time you call $() you are calling function to traverse the DOM and find the elements you are passing in, this takes time.
var prlogo = $("#prlogo");
prlogo.html('');
prlogo.html('img'
etc
 
i understand, but what i am working on is very temporary... it will be coded professionaly in time to come, but for now, we just need something which doesn't throw any errors
and is reasonable to use.... hence all the bad coding
 
hold on
how are the images coming in?
path/to/images.php <- I return a random image
path/to/indexedImage1.png
path/to/indexedImage2.png
 
user is uploading an image...
it uploads
and then displays in place
all without re-freshing and without iframes
 
ok uploading without iframes or refreshing is not possible in IE<10
FormData is the only solution to xhr file uploads without iframes or flash
 
i am using this
i have the code to get it to copy the html when the page loads
but not for when it changes
 
1:00 PM
@FlorianMargaine The quote he posted is totally offtopic, but he's right in that when no precision is needed, you do not really need to use setTimeout
 
again, i know you will not approve, but i'm using jquery to get that
 
lol there is nothing wrong with jQuery in theory
 
I would not downvote
 
$(function() {
$("#input_2_16").val($("#prlogo").html());
});
 
but I am seeing BAD code from you because jQuery masks common things
Local Variables are your friend.
jQuery's god object ($) is not
@Miro I feel compelled to help you - don't know why :P
 
1:02 PM
hahaha
im glad you see my pain
 
@FlorianMargaine Update to my first response: The quote you posted is offtopic. It's about CPU consuming apps like games, not countdowns that should be executed once per second
 
You wouldn't downvote for that, just maybe a comment
 
GGG
hey guys
 
the practical benefits of setTimeout are usually in coding structure
 
GGG
here's something you can downvote - stackoverflow.com/questions/10011448/…
i DV'd the Q and both A's
 
1:07 PM
@GGG: I just answered that :p
 
GGG
@FlorianMargaine looking for trouble huh
 
well it's nice having someone struggling with js instead of jquery :/
 
@Miro ok gimmie a few minutes - i'm working on an example for you
you might pick up some things by reading and trying to adopt it
need a coffee and a smoke first though.
 
thank a lot rlemon... lifesaver
 
GGG
@FlorianMargaine true. +1 from me
 
1:08 PM
appreciate it grately
 
GGG
if (text1.value.length > 0 &&
        text2.value.length > 0 &&
        text3.value.length > 0 &&
        text4.value.length > 0)
^ this kinda sucks though
 
if( inputs.every( function(input){ return !!input.value; } ) )
can be multi-lined
:p
 
GGG
@Esailija "0"
 
what?
"0".length > 0
!!"0" true
so they are equal
 
GGG
ah right
 
1:13 PM
just memorize -0, +0, NaN, "", null, undefined, false
 
@OctavianDamiean Well yes but...like ok ,SQL is feeding php which is feeding ajax to main page. through all this, how can i know ...or how can the code know when something is new.
 
GGG
too much php
 
that's all there is to it :P
 
someone told me to do a "while" loop...but not sure how to relate it to data on a table that gets new info automatically. Im a noob so sorry if i seem lost...cause i am lol
 
Though when you use == it makes other conversions before boolean so "0" == false but !!"0" is truewhile what happens in the comparison is !!+"0"
 
1:16 PM
@GGG: yup, I just edited
using forEach on a NodeList /o/
 
GGG
@Esailija yeah i was thinking of php for some reason... was writing php all night
what is going in there
 
document.getElementById('form-id').onkeypress = function(e) {
	var inputs = [this.text1, this.text2, this.text3, this.text4];
	document.getElementById('submit-button').disabled = !inputs.every( function(input){ return !!input.value; } );
}
 
GGG
oh nm it was just something dumb
 
@Esailija: what's this every method?
 
GGG
1:20 PM
might as well put that inputs array outside the key handler
 
works on NodeList?
 
GGG
nothing works on nodelist
 
[].every.call( NodeList, fn );
 
GGG
well yeah that works
 
1:21 PM
but in this case we have regular array
 
nice one btw
gotta see if es5-shim implements this
 
yep
it implements all of them
 
GGG
does every exit early?
 
it doesn't require any special functionality
@GGG yes
 
GGG
nice
 
1:23 PM
it's easier to code for early return + more performance
so kind of no-brainer
 
@Miro lol got side tracked... . i haven't forgotten about you
 
@Esailija: you allow me to add your code to the answer? :)
 
@FlorianMargaine sure but the var inputs is pretty hacky lol
could be var inputs = [].slice.call( this.querySelectorAll( '[type=text]') );
 
GGG
wait so every with the anonymous function performs better than, say, a for loop?
 
lol yes
 
GGG
1:26 PM
that doesn't sound right
the function should be adding stuff to the scope chain, slowing things down, no?
 
@GGG you can break for loop early with break
 
@rlemon, no problem, i'm playing with it myself
 
stop playing with yourself missed the it
 
Indeed. I didn't :D
 
you guys get bored here, dont you...
hahaha
 
1:27 PM
No we're programmers, humour is beyond us.
 
We're just trolling occasionally.
 
hahaha
 
hm
to break out of a forEach method in the callback function, I should use return right?
 
@OctavianDamiean Occasionally?
 
you can't break out of forEach I think
 
it will always iterate every one
 
I wish the Chromium developers would use different binary names for their beta and daily channels like the Mozilla people do with Firefox.
 
they do, don't they?
Canary, etc
 
@rlemon Sshhh! He doesn't know that we are professional trolls!
@FlorianMargaine No, I'm talking about the install path and binary names.
If you install from their daily channel for example you'd uninstall your regular Chromium version.
Which sucks.
 
1:32 PM
oh.
yeah, indeed
 
The Mozilla guys solved that by renaming their Aurora version to firefox-trunk which doesn't interfere with the stable Firefox version.
 
on Mac, google chrome canary is a completely different app, so it's not a problem
 
although the profiles are mixed -_-
 
checks to see if he didn't miss something
 
1:34 PM
I'm not talking about chromium but google chrome
dunno for chromium
 
IE7, y u no support :after
:'(
 
IE7 IE, Y U NO ANY GOOD?
 
IE Y U EXIST?
 
does ie8 support :after :o
 
1:37 PM
does IE still exist?
is it not dead yet?
 
Unfortunately.
It's still the most used browser.
 
it will never be dead
that's the sad thing
 
IE is like stupidity, you can't cure any of them.
 
IE10 is on the right way though, implementing silent update
 
@Esailija yep, it does
 
GGG
1:39 PM
@Esailija for loop smokes every
 
@FlorianMargaine i somehow have the feeling that they'll manage to screw up even that
 
@GGG: yeah, but way less "semantic"
 
GGG
oh come on
 
also, every might win if it stops before the end
 
and the every is a one-liner
 
1:40 PM
exactly with their new update-policy trough windows update, where they provided a tool to deactivate the ie update
Why would you even do something horrible like that?
 
it could be return this.array.every(function(x){ return x < 4; });
but yes of course its slower
not that it matters
 
GGG
it's quite a bit slower.. i don't think i'd use it in any tight loops
 
being this much slower is a shame yeah :/
 
GGG
also, a for loop is so common across different c-like languages, it seems more appropriate to write it lik ethat
 
micro optimization paranoia is evil
 
GGG
1:42 PM
i think a for loop is clearer than every
 
@Esailija: it's not premature optimization, it's 10 times slower
 
relatively yes
in absolute sense, it's still doing 2.5 million per sec
 
hm, yeah, I guess
 
of course if you are doing some hardcore processing you should optimize those things
 
@GGG: agreed. I really think .forEach is a very convinient and clear way to write non-high performance loops, but .every and .some are some kind of.. questionable
.filter() is of course useful again and easier to write
 
1:44 PM
may be a dumb question... but I use innerHTML to get the HTML content string of an element... how do I get the element and it's contents as a string.
 
GGG
all of those iteration functions are useful and easy to write... no arguments there
 
innerHTML.toString() ?
 
<form name="image-upload-form" action="" method=""> contents </form>
document.forms['image-upload-form'].innerHTML; // gets me the contents, I want the form as well.
 
@jAndy: didn't know about .filter(), nice!
 
.every and .some are always easier to write and use in conditions than for loops
you can't even put a for loop in a condition
 
1:45 PM
@rlemon: you mean outerHTML ?
 
outerHTML
hrmm. forgot about that
 
@FlorianMargaine: well I guess it is ECMAs implementation for a missing .grep() method
they didn't forget about .map() tho
 
Pretty hard to see how this is even close to elegant
var condition = true,
	i, l = array.length;

	for( i = 0; i < l; ++i ) {
		if( !array[i].value ) {
			condition = false;
			break;
		}
	}

	if( condition ) {
		selfDestruct();
	}
when compared to
	if( array.every( function( elem ) {
		return !!elem.value;
	} ) ) {
		selfDestruct();
	}
 
GGG
not everything is about being elegant
for( i = 0; i < l; ++i ) {
is immediately recognizable
to anyone with any kind of experience in any c-like language
.every is not.
 
1:52 PM
optimize for those who know the language...
 
GGG
but it's not "optimization" either
 
when you see MDN's implementaion for .every it looks elegant again
Array.prototype.every = Array.prototype.every || function _every(fnc /*, thisv */) {
    if( this === undef || this === null ) {
        throw new TypeError( 'Array.prototype.every' );
}

var t = this instanceof Object ? this : new Object( this ),
len = t.length >>> 0,
i = 0,
thisv = arguments[ 1 ];

if( typeof fnc !== 'function' ) {
    throw new TypeError( 'Array.prototype.every' );
}

for(i = 0; i < len; i++) {
    if( i in t && !fnc.call(thisv, t[i], i, t) ) {
       return false;
    }
}

return true;
hmm.. where is dat indention
 
you should take every opportunity to not make it look like any c-language anyway because it's not like them at all :p
 
GGG
...except for its syntax
 
user1385191
"poly"[buzzphrase](s) are inelegant by nature as they try to replicate exact behavior, which is wrong
 
user1385191
1:55 PM
that use of instanceof is looking pretty gross
 
GGG
instanceof Object is pretty scary
 
Yay I have no real clue why they are doing that there
 
bitwise operators are also "hey I don't care about readability!"
 
GGG
boxing it, apparently
 
in strict mode, this might not be an Object
 
1:57 PM
neither for t.length >>> 0 except they want to guarantee positive values or somethign
 
t.length >>> 0 is just ensuring 32 bit unsigned integer length as it is in the specs
 
GGG
| 0 would have looked nicer
 
| 0 is signed integer
it caps at 2 billion or so
 
GGG
oh right
 
^ 0 might work aswell there
 

« first day (536 days earlier)      last day (4398 days later) »