« first day (600 days earlier)      last day (4331 days later) » 

12:14 AM
a basic "ajax preloader anim for div" toturial!
 
12:53 AM
Is it possible to send binary data via socket.io ?
And is that faster for sending jpeg images than converting them to a base64 string and sending them?
 
1:09 AM
it is possible... fast idk.
i know that @Abhishek did some binary stuff for his audio work.
> Bandwidth optimized binary encoding for JavaScript
@IvoWetzel is the author of that
 
user1385191
1:48 AM
I'm going to hop over to the CSS room; if anyone wishes to give some site critique, I'd appreciate it.
 
0
Q: what is standard approach to create a responsive website using javascript,php ajax and perhaps zend framework

shawndreckI am working on a web system currently and plans to heavily use javascript with ajax to make the user interface more friendlier, not fancy as such. The javascript will be used for client side form validation, data loading from server and creating proper content with the result, also to for float...

 
user1385191
(hint: it's CSS)
 
Anyone ever have any luck getting prettify.js working (or another solution) for syntax hilighting that works on Tumblr's mobile app?
 
2:17 AM
I need to check if an element exists, but that element is an iframe. Would that have a length to it?
 
2:52 AM
In Soviet Russia, questions you!
 
in regex, if I want to add dashes and exclude pound signs from an entire string, how would the regex look? replace(/\s+/g, '-')
i dont understand regex in the slighest
 
3:10 AM
@HowdyMcGee If you're using JQuery it's really simple and yes it'll have a length. jquery.com <--- If you're not using, you should be. $("iframe") will return a collection of all matching tags.. in this case the iframes themselves. Then you can do $("iframe").length to see how many there are... And all sorts of other fun things.
 
@VulgarBinary Lol, you can do it with simple JS: document.getElementsByTagName('IFRAME').length.
@Howdy_McGee What do you mean "Pound sign"?
 
#
erm, hashtag
 
@Howdy_McGee Ehm... I don't understand what you mean about add dashes and exlude pound signs... Can you make me an example?
an example like before and after things..
 
sure ill throw it in jsfiddle. One second
 
And.. sorry for my english..
@Howdy_McGee Ok, I am going to wait.
 
3:19 AM
Right now this is adding dashes - jsfiddle.net/LTgbQ
and I'm trying to remove the '#'
 
im getting "Not Implemented" error for js for IE8 when running window.onload = loadScript();. How can i patch this to work in IE8
 
@Mike Maybe the right code is window.onload = loadScript; without the ()..
 
is it? No idea here, i didnt write the code.
 
@Mike Try it, because when you assign it with (), the browser thought that you want to call the function and return the value to onload..
@Howdy_McGee I thing that you can do it this way: str.replace(/(\s+)/g, '-').replace(/#/g, ''), just use 2 regexs.
 
ok cool! Thanks
 
3:25 AM
@Howdy_McGee You are welcome.
 
hhh
3:50 AM
Hello, do you know where can I download them? I am trying to get this working, view-source:http://jqueryui.com/demos/sortable/display-grid.html, on my own computer.

<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.mouse.js"></script>
<script src="../../ui/jquery.ui.sortable.js"></script>
<link rel="stylesheet" href="../demos.css">
 
@hhh Hello again.
 
hhh
Hi, been learning the whole day (or night) JS :)
 
@hhh Well, the CSS part is the easy part, what is the problem?
 
hhh
code.jquery.com/jquery-1.7.2.min.js <--- I use only this lib
where can find the ui.core.js etc?
 
hhh
3:53 AM
jqueryui.com/download <-- this one?
Can I download everything in one?
1.8 or 1.7?
They are backward-compatible, I suppose so does not matter or?
 
@hhh 1.8
 
hhh
They are backward-compatible, I suppose so does not matter or?
 
@hhh There said "1.8.21: for jQuery 1.3.2+"
your jQuery is 1.7.2...
 
hhh
(sorry I have a bit poor internet connection so lagging...)
 
@hhh No problem.. I am with 512kbps..
 
hhh
3:57 AM
(I am with a bit broken RJ45 that is the problem, one hand keeping the cable...time-to-time)
...but I wil try the custom mod, thank you for your help
 
@hhh You are welcome.
 
4:15 AM
 
 
2 hours later…
5:48 AM
1
 
 
1 hour later…
7:16 AM
anyone know where I might find a complete doc of the table DOM0 API?
 
7:43 AM
console.dir( document.createElement("table"))
createCaption: function createCaption() { [native code] }
createTFoot: function createTFoot() { [native code] }
createTHead: function createTHead() { [native code] }
deleteCaption: function deleteCaption() { [native code] }
deleteRow: function deleteRow() { [native code] }
deleteTFoot: function deleteTFoot() { [native code] }
deleteTHead: function deleteTHead() { [native code] }
insertRow: function insertRow() { [native code] }
didn't even know about those :D
 
ok, so I need to do this for tr, td, tbody, thead, tfoot
which is why I was asking for "a complete doc" :p
console.dir( document.createElement('tr').__proto__ )
 
I assume you have already googled if you ask this :P
 
yeah, mdn's not much help
and google either, ddg too... if you get a good result I'd be happy :D
console.dir( document.createElement('td').__proto__ ) // nothing but constructor and __proto__
 
yea
remember to also log the object itself for special properties
 
however, that still doesn't show me all the API like rows and cells, shown in the object itself, but mixed in with all the other crappy shit
thus my question: anyone know where I might find a complete doc of the table DOM0 API? :D
oh wait, I might actually have it
there is a lot (anchors, forms, etc) but not tables :(
this doc is great though
 
7:53 AM
Object.getOwnPropertyNames(document.createElement("div")).diff( Object.getOwnPropertyNames(document.createElement("table")))
["cellSpacing", "tFoot", "bgColor", "tBodies", "width", "tHead", "rules", "border", "caption", "rows", "cellPadding", "summary", "frame"]
also
[].__proto__.diff = function(arr) {
    var ret = [];

    arr.forEach( function(v){
        if( !~this.indexOf(v) ) {
            ret.push(v);
        }
    }, this);

    this.forEach( function(v){
        if( !~arr.indexOf(v) && !~ret.indexOf(v)) {
            ret.push(v);
        }
    });

    return ret;
};
 
diff?
oh :D
and you don't get the __proto__ however
:p
 
I used it for shorthand
it was shorter to write than Array.prototype
:P
 
no, I meant for the table element
 
[].__proto__.diff = function(arr) {
    var ret = [];

    arr.forEach( function(v){
        if( !~this.indexOf(v) ) {
            ret.push(v);
        }
    }, this);


    return ret;
};
actually that should be it
the second is not needed
proto you can log directly
but if you log the object itself, you have to look for special properties
this makes that easier
because it shows what properties are special (don't exist in div element but exist in table element)
 
I know, I'm just saying you're not good enough to have it everything in one line, you suck
 
7:57 AM
LOL
 
tr `["vAlign", "bgColor", "sectionRowIndex", "cells", "chOff", "ch", "rowIndex"]`
td `["axis", "noWrap", "vAlign", "bgColor", "colSpan", "width", "cellIndex", "abbr", "rowSpan", "headers", "height", "chOff", "scope", "ch"]`
this is actually quite handy :D
applet ["vspace", "code", "width", "alt", "codeBase", "height", "hspace", "archive", "name", "object"]
 
btw
does this work too?
[].__proto__.diff = function( arr ) {
    return arr.map( function( v ) {
        if ( !~this.indexOf( v ) ) return v;
    } );
};
 
lol yes
but it's inversed
In set theory, a complement of a set A refers to things not in (that is, things outside of), A. The relative complement of A with respect to a set B, is the set of elements in B but not in A. When all sets under consideration are considered to be subsets of a given set U, the absolute complement of A is the set of all elements in U but not in A. Relative complement If A and B are sets, then the relative complement of A in B, also termed the set-theoretic difference of B and A, is the set of elements in B, but not in A. The relative complement of A in B is denoted according to the ISO...
 
doesn't work like this
 
8:01 AM
what?
 
this is just window, you need var that = this
 
no, you never need that or self:P
use the second argument
map( fn, context )
 
[].__proto__.diff = function( arr ) {
    return this.map( function( v ) {
        if ( !~arr.indexOf( v ) ) return v;
    } ).filter( Boolean );
};
 
[].__proto__.diff = function( arr ) {
    return arr.map( function( v ) {
        if ( !~this.indexOf( v ) ) return v;
    }, this );
};
 
8:03 AM
the fuq why doesn't mine work
it's supposed to give set of elements that exist in B, but not in A
 
!!> [].__proto__.diff = function( arr ) { return arr.map( function( v ) { if ( !~this.indexOf( v ) ) return v; }, this ); }; Object.getOwnPropertyNames(document.createElement("div")).diff( Object.getOwnPropertyNames(document.createElement("table")));
 
ok yours works if you add .filter( Boolean )
 
mine works without :/
 
yea but you get ugly sparse array
filter boolean removes all the undefined elements
 
yeah sure
yup that's nice, I never remember about it :D
 
8:05 AM
it's a neat trick to make map return an array with different length than original
var names = function(el){
    return Object.getOwnPropertyNames(document.createElement(el));
};
names("div").diff( names("table"))
 
how is getOwnPropertyNames different than Object.keys?
 
it gets only the items on the object itself not in proto
it also gets items that are not enumerable
 
Object.keys gets objects in proto?!
no it doesn't
 
Object.keys(Math).diff( Object.getOwnPropertyNames(Math))
["max", "ceil", "SQRT2", "PI", "pow", "log", "LOG2E", "tan", "sqrt", "exp", "random", "min", "floor", "atan2", "cos", "atan", "acos", "abs", "round", "asin", "LN2", "LOG10E", "sin", "E", "SQRT1_2", "LN10"]
 
getOwnPropertyNames gets items in the proto and not enumerable, right?
or the only difference is that getOwnPropertyNames gets non enumerable props?
 
8:10 AM
I see object keys doesn't get items in proto
but Object.keys(Math) is empty
so it doesn't get non-enumrable
 
yeah, Object.keys( obj ).forEach( fn ) is nice because it's the same as for ( var prop in obj ) { if ( obj.hasOwnProperty( obj ) ) {} }
so it avoids unnecessary boilerplate
 
var getSpecial = function(el){
    el = document.createElement(el);
    return Object.getOwnPropertyNames(document.createElement("div")).diff( Object.getOwnPropertyNames(el)).map(function(name){
        return name + " : " + el[name];
    });
};
getSpecial("table")
["cellSpacing", "tFoot", "bgColor", "tBodies", "width", "tHead", "rules", "border", "caption", "rows", "cellPadding", "summary", "frame"]
can it become more easier :D
 
:p
@FlorianMargaine post you ajax code and html — thecodeparadox 43 mins ago
wth?!
hehe
 
["cellSpacing : ", "tFoot : null", "bgColor : ", "tBodies : [object HTMLCollection]", "width : ", "tHead : null", "rules : ", "border : ", "caption : null", "rows : [object HTMLCollection]", "cellPadding : ", "summary : ", "frame : "]
 
@Esailija is the bot up?
 
8:14 AM
no, sec
 
is the DOM available in a worker context?
 
no
 
it just runs es5
 
well, that's nice already
 
8:17 AM
getSpecial("input")
["maxLength : 524288", "size : 20", "incremental : false", "max : ", "valueAsDate : null", "selectionStart : 0", "checked : false", "defaultValue : ", "selectionEnd : 0", "formEnctype : application/x-www-form-urlencoded", "src : ", "type : text", "pattern : ", "form : null", "readOnly : false", "alt : ", "min : ", "accept : ", "webkitSpeech : false", "formMethod : get", "valueAsNumber : NaN", "autocomplete : ", "value : ", "formTarget : ", "dirName : ", "validity : [object ValidityState]", "webkitdirectory : false", "step : ", "useMap : ", "required : false", "placeholde
wow
 
wow
wait
formEnctype on an input?
 
yeah in html5 an input doesn't have to be inside form
in that case the form that "contains" the input, can be accessed with those form stuff
 
lol @ webkitSpeech :D
ok :/
 
it's pretty good
 
webkitGrammar, webkitdirectory, webkitSpeech...
 
8:18 AM
the form having to contain all its input elements is extremely restricting
 
yeah, how does it degrade though?
 
I don't think it does
with typical 90's form, this feature wasn't needed
 
something like the following works?

<input type="text" form="some-name" name="hey">
<input type="submit" form="some-name">
 
form HTML5
The form element that the input element is associated with (its form owner). The value of the attribute must be an id of a <form> element in the same document. If this attribute is not specified, this <input> element must be a descendant of a <form> element. This attribute enables you to place <input> elements anywhere within a document, not just as descendants of their form elements.
it's the form's id
not name :P
 
ooooh I get it
which means this works:

<input type="text" form="some-id" name="hey">
<form id="some-id">
<input type="submit">
</form>
 
8:23 AM
yeah and you can have inputs inside the same form use different form
because you don't wanna use the same form for everything
like when you wanna make atomic submits or full submits
I mean both
 
like the main form contains all the things, with inputs having submit next to them
 
that's nice
 
when you submit the whole form all inputs get submitted
but you can also submit the inputs separately
 
oh that's cool
 
8:24 AM
it's a problem I had to work around with ad-hoc ajax
where you don't even have a form anywhere but just make post request from scratch
 
heh, that's ugly
not very degrading :p
I mean
no degradation at all.
 
well no if you want full submit instead of ajax
no-js degradation is major waste of time unless you are working on government page and require it by law
imagine doing complex forms where you can add elements without js
you need server side action for everything
all this for small minority of users that know they have js disabled
and can turn it on
man the input tag is overloaded
 
0
Q: Calling a parameterized javascript function from php

GingerI need to call a javascript function from php, by passing a value in php variable. My code goes like this: echo '<tr class="trlight"><td onclick="callVehicle('.$qry_vehicleid.');"><label>Call Vehicle</label>&nbsp;</td></tr>'; And in javascript file I try...

 
well's I got an exam to attend, laters.
 
8:42 AM
0
Q: Advice for learning Javascript with prior knowledge of C++?

CrynixRecently I have become interested in learning Javascript for web development. I currently know HTML, CSS, and beginner/intermediate C++. I understand polymorphism, inheritance, and all of that fun stuff. Would any of these skills carry over to Javascript? In what key ways does Javascript differ f...

 
I tried to fizzbuzz, unfortunately this doesn't work :(
Array(100).forEach( function( el, index ) {
    if ( index % 15 ) console.log( 'FizzBuzz' );
    else if ( index % 5 ) console.log( 'buzz' );
    else if ( !index % 15 ) console.log( index );
} );
Array(100).forEach( function( v ) { console.log( v ); } ); // nothing :(
 
>_>
 
from
 
either you format your code, or I'm not even going to read it
 
8:53 AM
@Abhishek what? :(
@user1425502 hint: use Ctrl + k
 
new Array :3
 
@FlorianMargaine I am using webmatrix here I try CTRL + SHIFT + F. it's work in webmatrix but not in chat.
 
in this chat, it's ctrl + k
 
OK
exports.CreateNewUser = function(login, pass, mail, callback) {

    var sql = "insert into `user`(login,mail,pass) values(?,?,?)";
    client.query(sql, [login, mail, pass], function(err, results, fields) {
        if(!err) {
            callback(results);aaa
        }
        else {
            callback(results, err);
        }
    });
};
registerUser(function(newUserAttrs) {
        var login = newUserAttrs[this.loginKey()];
        user.CreateNewUser(newUserAttrs.login, newUserAttrs.password, newUserAttrs.email, function(res, err) {
            if(!err) {
                return usersByLogin[login] = newUserAttrs;
            }
            else {
                throw err;
            }

        });

    })
 
@Abhishek still nothing
 
8:57 AM
intresting
 
@user1425502 that should work
@Abhishek also, Array(100).length === 100 :)
 
try Array('google','doogle')
 
Array('google','doodle').forEach( function(v) { console.log(v); });
google
doodle
:)
 
so probably it wont do nothing for nothing
!!> Array('mangle','tangle').forEach(function(v){ console.log(v) });
 
ooh I know, wait
 
9:01 AM
undefined
Logged 1:"mangle"
Logged 2:"tangle"
 
!!> Array(100).forEach(function(v){ v=Math.sin(new Date().getTime(); console.log(v); });
 
@Abhishek SyntaxError: Unexpected token ;
 
!!> Array(100).forEach(function(v){ v=Math.sin(new Date().getTime()); console.log(v); });
 
@Abhishek undefined
 
daFuQ ?
 
9:03 AM
Array( 100 ).filter( !Boolean ); // "false is not a function"
!!> Array(100).join('1').split('').map(function(v,i){return i;})
 
@FlorianMargaine [object Array] [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29‌​,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56‌​,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83‌​,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98]
 
alright, this works
!!> Array(101).join('1').split('').map(function(v,i){return i+1;}).forEach( function( el, index ) { if ( index % 3 === 0 ) console.log( 'fizz' ); else if ( index % 5 === 0 ) console.log( 'buzz' ); else if ( index % 15 !== 0 ) console.log( index ); } );
 
undefined
Logged 1:"fizz"
Logged 2:1
Logged 3:2
Logged 4:"fizz"
Logged 5:4
Logged 6:"buzz"
Logged 7:"fizz"
Logged 8:7
Logged 9:8
Logged 10:"fizz"
Logged 11:"buzz"
Logged 12:11
Logged 13:"fizz"
Logged 14:13
Logged 15:14
Logged 16:"fizz"
Logged 17:16
Logged 18:17
Logged 19:"fizz"
Logged 20:19
Logged 21:"buzz"
Logged 22:"fizz"
Logged 23:22
Logged 24:23
Logged 25:"fizz"
Logged 26:"buzz"
Logged 27:26
L
 
arf, too long
!!> Array(101).join('1').split('').map(function(v,i){return i+1;}).map( function( el, index ) { if ( index % 3 === 0 ) return 'fizz'; else if ( index % 5 === 0 ) return 'buzz'; else if ( index % 15 !== 0 ) return index; } );
 
@FlorianMargaine [object Array] ["fizz",1,2,"fizz",4,"buzz","fizz",7,8,"fizz","buzz",11,"fizz",13,14,"fizz",16,1‌​7,"fizz",19,"buzz","fizz",22,23,"fizz","buzz",26,"fizz",28,29,"fizz",31,32,"fizz"‌​,34,"buzz","fizz",37,38,"fizz","buzz",41,"fizz",43,44,"fizz",46,47,"fizz",49,"buz‌​z","fizz",52,53,"fizz","buzz",56,"fizz",58,59,"fizz",61,62,"fizz",64,"buzz","fizz"‌​,67,68,"fizz","buzz",71,"fizz",73,74,"fizz",76,77,"fizz",79,"
 
9:09 AM
still too long.
well, doesn't matter, got my shit working :D
@Abhishek iterators functions don't work on empty arrays it looks like, so join does however :x
hmmm
function log( v ) { console.log( v ); }
var arr = [];
for ( var i = 0; i < 100; i++ ) {
    arr.push( undefined );
}
arr.forEach( log ); // works
Array( 100 ).forEach( log ); // doesn't work
 
@FlorianMargaine intresting
and that just found its way in my cheatsheat
 
your cheatsheet? why?
and what?
@Abhishek ?
0
Q: Calculating Total Overtime Working Hours using Condition

David AlwisNeed your help with my case. How to make calculating total overtime working hours using condition ? Example : using input type, OT From <input type="text" name="ot_from"> OT To <input type="text" name="ot_to"> Total Hours <input type="text" name="total_hours"> Working days ...

is my comment really bad?
 
9:26 AM
no, it seems fair.
 
thanks.
 
Seems like a homework question, too. Reminds me of ICT in college, we'd get stupid programming questions like these and have to write pseudo-code for them.
 
maybe, should I add the "homework" tag?
 
Maybe. I've never been a fan of adding it without at least clarifying, though.
 
I added a shortcut to ncore :)
 
9:30 AM
the iterator functions thingy
cause i can lose that from my mind and keep on wondering why the heck they arent working lol
 
Ok, made it even terser! :)
 
@Abhishek it works on an array of undefined values, it doesn't on Array(100)
 
hmm
 
hmmm
I think I know why though
 
@FlorianMargaine Array(100) is sparse
 
9:33 AM
Array(100) has no value in itself, it has the correct length, but no value in it
 
it's the same as var arr = []; arr.length = 100
 
All it does is preserve a block of memory in advance
so you dont have to expand the memory for the array
but that's VM level details you shouldnt worry about
 
but Array( 100 ).join('1').map( function(v) { return; } ); works /o/
 
Jun 3 at 19:10, by Raynos
[].map.call(Array(25).join(), function () {
    return parseInt(Math.random() * 10, 10).toString()
}).join("")
 
9:35 AM
it's the same as var arr = []; for ( var i = 0; i < 100; i++) { arr.push( undefined ); }
 
@FlorianMargaine note Array(100).join('1') generates 99 1's not a 100
 
yes, it's why I'm using map after to generate the correct array
but if I don't use join('1') I can't map over it
and wait, that's actually Array( 100 ).join('1').split('').map( function(v) { return; } );
but yeah, this is better: [].map.call( Array( 100 ).join(), function( v ) { return; } );
 
No
that's not the point
the point is Array( 100 ).join().length === 99
@FlorianMargaine note [].map.call( someString , iterator ) may have browser compliance issues
 
hello dear persons
 
@Raynos which browsers?
hi @MeLight
 
9:43 AM
help in jquery?
Refused to display document because display forbidden by X-Frame-Options. Any idea how to get rid of this error?
 
You don't.
 
@FlorianMargaine to me?
 
then what is a work around?
 
@ShyamK:: Undefined Syntax Error , function help was called with invalid argument 'jQuery'
 
9:45 AM
You're playing with cross-domain, so you can't
 
You need to have a server-side cross-domain header
for server side
 
and CORS doesn't work in all browsers
 
cos I'm using an iframe to display a map.. and I want it to center on the users geo location
@FlorianMargaine what is cross domain?
@Abhishek so I require php/java server side stuff too?
@FlorianMargaine CORS?
 
no CORS
for cross-domain, google "cross-domain iframe" on google
 
yes I am using the iframe from google maps to show the map
tps://maps.google.com/?ie=UTF8&amp;ll='+position.coords.latitude+','+position.co‌​ords.longitude+'&amp;spn=48.678055,86.572266&amp;t=h&amp;z=4&amp;output=embed
 
9:50 AM
you can't.
 
I'm trying to change that link depending on the user lat and long..
 
use what's provided when you click on "embed" in google maps
 
hmm..
 
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&amp;ll=37.0625,-95.677068&amp;spn=59.379225,135.263672&amp;t=m&amp;z=4&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/?ie=UTF8&amp;ll=37.0625,-95.677068&amp;spn=59.379225,135.263672&amp;t=m&amp;z=4&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
 
then what other way is there to show a map to the user depending on his location
@FlorianMargaine that is having a link to the larger map also.. I don't want that
 
9:52 AM
yeah, sorry, your code should work
you just change the iframe's src, right?
 
@FlorianMargaine yes
If this won't work then is there any other way to show a map and then change the central location to the user's current location?
 
no idea.
or replace the iframe
 
replace it with something else?
but then how to display the map?
 
replace it with an iframe that has the correct src
don't change the src directly, clone the iframe, change the src, and replace the old iframe with the new
 
pls explain..
clone the iframe?
how is that done?
 
9:56 AM
el.cloneNode()
 
what I did right now is load the iframe with the right src.. then change it with jquery to the next src in the ready method..
I thought that would work.. guess I was wrong :(
I shall check up on cloneNode.. I have not seen or used this before. Some light reading before I implement it :)
el means element right?
 
lol.
 

« first day (600 days earlier)      last day (4331 days later) »