« first day (597 days earlier)      last day (4351 days later) » 

user1385191
6:00 PM
so Safari 3.1 breaking ::after turned out to exist in Safari 4 too.
 
@Justin Are you talking about applications (like this chat or gmail) or websites
 
Because websites should have a no-js version in any case
 
user1385191
bingo
 
why should websites have a no-js version in any case
 
user1385191
6:01 PM
but I'm getting pretty sick of sites that store a cookie to detect if JavaScript "exists"
 
I use CSS + Server Side JS to emulate js if not detected , is that way bad ?
 
@MattMcDonald never said it would... Just saying I don't support IE usage at all Though I only block IE7 and below..
 
user1385191
because scripts don't always load
 
user1385191
and scripting is not always enabled
 
should my car run without gas?
 
6:02 PM
then it should be enabled
 
should my shoes stay on without laces
 
@rlemon it should and shoes do
 
user1385191
oh boy…
 
98.6% screen readers have js enabled
 
My shoes stay on without laces, so yours should too ;)
 
user1385191
6:03 PM
Thomas Fuchs made this same argument years ago and it was picked apart then
 
mine dont :<
 
lol
 
YEARS AGO
this isn't years ago
 
if you dont have JS enabled idc about you
 
^ that!
 
6:03 PM
that % has to be so low..
and if you dont wth not?
 
if you don't have JS enabled you are well aware of it and I'm not gonna cater to you
 
if you don't have JS enabled go pick up a news paper, or read a book, or something. FFS get off the PC because you are using it wrong!
 
Websites are documents. You try to present information
 
default settings = the only settings for most users
 
user1385191
6:04 PM
what I do is set up a static state with HTML
 
which includes js enabled
 
user1385191
then the CSS decorates it
 
user1385191
then the JS will run
 
lol, the people who run JS free browsers also enjoy looking at the design of the site Matt just posted.
 
LOL
 
6:05 PM
lol
 
yes hash bang navigation is stupid
 
user1385191
the pertinent part is the bottom
 
@Esailija yes but it is effective way to store relative links to xhr loaded content.
 
history api can transparently fallback to normal pageloads
because the links are the same
 
that is all I have ever used it for
 
user1385191
6:06 PM
the point is about expecting JS to work everywhere
 
user1385191
which was picked apart in that post
 
and I generally store the relative pages "template" free in the files so if you remove the # everything works without a layout
 
^
thats what Im doing currently
not even using hashes or anything, just standard /blah /foo
 
works fine, Google still indexes the 'ugly' version of the pages
 
user1385191
let me use an example for static content
 
6:07 PM
my pages look exactly the same still
I can just do cool transitions with the js method
 
@Loktar well i have no SS
 
user1385191
the table is static
 
user1385191
a text node is appended for each result along with a class change for the row
 
user1385191
if CSS fails, the user still sees the text node
 
user1385191
6:08 PM
if the text node fails (has happened to me), the class change provides a cue as well
 
if CSS fails, JS fails, and HTML fails Matt will show up at your door and shake your hand... you won!
 
lol
psh I wood burned my site
so if electricity fails
meh
 
if electricity fails we are all gonna die
have you seen jurassic park
 
we can expect JS, CSS, and HTML to work in all browser, the specs which they are working from is subject to change.
I can 'turn it off' - but then I expect things not to work.
just like I can turn off the volume of my TV show, and not mentioning CC (as that is a feature), I can expect not to be able to hear it!
 
JavaSCRIPT is the most richest discussion room
we have talks on so many topics!
 
6:15 PM
Hey all
anyone here into doctor who?
^_^
 
<3 The Doctor
 
o/
Brilliant!
 
<3 <3
 
... except when my Shadowrun GM decides that the Doctor needs to make a guest appearance.
 
6:16 PM
Follow my page then ^^^
:-)
 
I dont have google+
 
I have the biggest g+ Doctor who page ^_^
 
wait i do (O_O)
 
idk how i did it
 
lol
 
6:18 PM
>_< now i have to re-enter my 28 Ascii characther password :-(
 
seriously
 
and if anyone here wants to be a manager they can :-)
 
epic....
@Neal i'd be your manager but I don't have the time ;)
 
haha neither do i.

I post randomly

^_^
 
6:19 PM
no one got the pun :<
less of a pun... it's more like a big ball of wibbly wobbly... time-y wimey... stuff.
 
hehe
 
+1 ed
iWater .. ZOMG!
 
that one is just... strange
 
6:23 PM
@rlemon haha thats ooooold :-P
 
iPhone branded .... gas stove?
iArm
But I have to say, i'm most impressed with the macbook my brother just got on ebay
 
lol
 
lol
Alright i am off to study
physics bye bye , wish me luck . After these exams NO college :D
 
function window.onload() {} is not valid javascript. Half of your project is dead code? — Esailija 4 mins ago
wtf
 
user1385191
 
6:30 PM
is there a bigger wtf
 
user1385191
function just work already; ugh (dammit) {}
 
how the hell do you write 100's of files without noticing that half of them don't work
 
hello. I have a very long json, I'm printing data on screen from this json, however it's very slow to parse it. I was using $.each() but it's slower than for(var i = item.length - 1; i >= 0; i--). However the last for lates 6secs to parse it. Any hint to optimize it?
 
user1385191
halo i hav a java functoin but it not work her is coad
2
 
user1385191
-thanks samir prandeep
 
6:32 PM
any hint to optimize json parsing?
 
user1385191
each is a loop abstraction
 
all the approaches I've tried still lates too much.
 
user1385191
of course it's slower than a regular loop
 
yes
 
@rogcg wheres your avatar from?
 
6:33 PM
but I'm using now for(var i = item.length - 1; i >= 0; i--)
@Loktar I've created.
 
ah ok
 
using for(var i = item.length - 1; i >= 0; i--) still lates 6secs
very annoying to the user
@Loktar here are some 8bit draws I make. thepixelr.tumblr.com
I dont have any clue to optimize it anymore
 
@rogcg heh those are awesome
 
wtf, it's not taking 6 seconds because of $.each vs for
 
@Esailija well, $.each lates more than improved for
 
user1385191
6:36 PM
…which was explained
 
but the improved for lates about 6secs
 
user1385191
it's slow because your data is massive
 
ok
 
no shit but chances are the loop still takes longer than the unacceptable 100ms
 
@Esailija what u mean
 
6:37 PM
I mean, something taking 6 seconds with $.each, wont take < 100ms with for
 
it's not taking 6secs with $.each. It's taking 6secs with for(var i = item.length - 1; i >= 0; i--)
 
@rogcg how fast is it with $.each?
thats really cool btw @rogcg lol I love old school pixel art
 
var l = 0, a = new Date();

while( new Date - a < 6000 ) l++
4558239
 
@Loktar me 2
 
though that test sucks
the number should be like a billion at least
new Date is expensive I guess
 
6:40 PM
@Esailija wait wait wait.. I dont understand. what u mean with all this u are showing me?
 
what are you doing with each iteration
booting an OS?
 
@Esailija I'm not using $each
I was using it before, but now I'm using the improved for loop
 
no, hes asking what are you doing within each loop
 
which is like this for (var i = item.length - 1; i >= 0; i--)
 
like inside of each iteration, what are you doing?
the loop isnt the issue
its whats going on during each iteration, or how large the dataset is
 
6:41 PM
well. I'm retrieviing a lot of data from DB and parsing the json to print a table in screen
 
each iteration your running a DB call??
 
is this node.js?
 
^ that sounds like an issue to me?
 
I'm doing a $('whatever').append(<td>bla bla bla</td>)
 
also an issue
 
6:42 PM
@Esailija no node.js
 
yeah definitly
 
ok there is a few wtf's
 
make a document fragment and append it all at once
 
^
 
making DB calls in a loop is always a wtf
 
6:42 PM
@Esailija I'm not making a db call in a loop
 
DB/DOM/any access calls in a loop === nono
^
 
just paste your loop code here
 
I retrieve the json from DB, and later I parse it making the appends to screen
u are misunderstaing the problem
 
appends in a loop are bad
 
6:43 PM
Long story short: loops are bad!
 
well, you can .detach
and then it's not bad
 
var df = document.createDocumentFragment();
for (loopy) {
     df.appendChild(node);
}
container.appendChild(df);
 
you can just append to node that is not in the dom to be rendered
 
yeah your forcing a reflow every time you append.. which the more elements makes each reflow a bit longer as well
 
I.E detach
 
6:44 PM
unless there is no parent node.
 
there is always a parent
 
nvm, I misunderstood you
 
except for document he is an orphan
 
@Esailija wait. Im gonna post my code
 
@rogcg see my code example :)
documentFragment FTW
 
6:45 PM
@rlemon I dont have any experience with that. I'm gonna need more help to understand it.
 
user1385191
I still need to debug cDF
 
a document fragment is basically a pseudo DOM whcih does not affect the DOM
i.e. no reflow
 
here is what I'm doing. This takes about 6 secs. paste.ubuntu.com/1023706
 
user1385191
it's a lightweight document
 
so think of it like a queue for adding element too before you dump them to the DOM and cause a reflow
 
6:46 PM
o dear jesus
 
user1385191
TIL how to append table rows and cells </reddit>
 
you just have to retrieve all tbody elements 8 times per each iteration?
 
think of it like this, you are stacking 2 piles of books. Is it easier to lift one of the current piles everytime and place one book under each time, or just put the old pile on top of the new pile?
 
so what u guise suggest me?
gimme a pseudocode
I dont know how to work with node
not even documentFragment
 
user1385191
def prayToCthulhu():
        pass
 
6:48 PM
has to go to a meeting, hopes the JS guys are gentle and shows rogcog an easy way he can understand IE jquery
 
user1385191
ah Python; the language of pseudocode
 
How does github know my profile picture ? Gravatar ? SO ?
 
Well, @rlemon gave him some code -- now all He really has to do is google that code up -- and he'll learn how to use it in his application rather than us feeding with him with a complete and working function...
 
user1385191
gravatar
 
user1385191
here's an em dash (—)
 
user1385191
6:50 PM
use it
 
Interesting ...
 
var item = jQuery.parseJSON(data);
item.reverse();

var tbody =  $('#pub_exib tbody'),
    parent = tbody.parent();

tbody.detach();

for (var i = item.length - 1; i >= 0; i--)
{
    var dateIniArray = item[i][5].split('-')
    var dateIni = dateIniArray[2] + "/" + dateIniArray[1] + "/" + dateIniArray[0];

    var dateFimArray = item[i][6].split('-')
    var dateFim = dateFimArray[2] + "/" + dateFimArray[1] + "/" + dateFimArray[0];

    tbody.append( '<tr class=" ' + (i % 2 === 0 ? "grid" : "") +'">' +
 
@Esailija what's the advantages of using documentFragment agains your approach?
 
nothing since I use .detach
 
6:53 PM
@Esailija so ur approach is better?
 
var item = jQuery.parseJSON(data),
	tData = document.createDocumentFragment();
for( var i = 0, l = item.length; i < l; i++) {
	var dateIniArray = item[i][5].split('-'),
		dateIni = dateIniArray[2] + "/" + dateIniArray[1] + "/" + dateIniArray[0],
		dateFimArray = item[i][6].split('-'),
		dateFim = dateFimArray[2] + "/" + dateFimArray[1] + "/" + dateFimArray[0];
	var tr = $("<tr></tr>");
	if( i % 2 ) {
		tr.addClass('grid');
	}
	tr.append('<td align=\'center\'> <input name=\'indice[]\' type=\'checkbox\' value='+ item[i][0] +' /> </td>');
 
well it was quickest to write
 
that uses documentfragments
ugh wtf
 
@rlemon I don't think you want to separate those appends
they are parsed as standalone html
which means table is created for every td
not sure though
 
well i copied his text into geany, started editing it, moved it to jsfiddle, copied it out, pasted it in here, formatting was effed so went into geany and copied that back...
ugh
ignore all of that code
 
6:56 PM
I'm testing DocumentFragment against using .detach(), and I dont see difference. It improves the same speed.
 
so how slow is it now
 
? just see if it takes 6 seconds or 100ms? you can't tell that by just looking at it? :P
 
@Esailija not 6 secs neither 100ms
in timeline, it shows waiting for 1ms
using detach
 
wut
how many items are there
 
6:59 PM
where?
 
in the array
 
817
 
pfft that is small frys
 
I'm following this tutorial to use DocumentFragment ejohn.org/blog/dom-documentfragments
 
well that is not a tut
that is an article outlining that we should be using this method
 
7:01 PM
@rlemon u understand what I mean. Right? ;)
 
pretty surprising you could write code to take 6 seconds with only 800 items
 
can you please post us a sample of the JSON
 
user1385191
this is old, but still interesting:
 
7:05 PM
I am so glad that page is valid html 4.01
and css too
 
but not only two, there are a lot.
 
user1385191
there's a whole slew of table-related methods at your disposal
 
@rogcg that cannot be it
 
why
 
7:07 PM
item[i][5].split('-'),
i'm trying to test it out
i can't without data
or at least some type of valid mock data
 
@rlemon dude. u asked for a sample. I posted a sample, the real json has more than 20 rows for each map.
however. It's already working.
I'm using documentfragment as u said, and it's fast now. thanks.
 
yea a same of your JSON not a sample of JSON :P
but ohh well, glad it's working
 
@rlemon whatever. you helped a lot, also @Esailija. I'm getting used to jquery, and stuff like that. I really want to learn more and more, and I thank you all for your patience.
 
7:29 PM
hi, how would I get the js to return an array of objects rather than an array of strings? Error msg is 'can't convert String into Array'. Any input appreciated. gist.github.com/2870125
 
@DavidPardy Sorry, I don't understand Ruby. or where JS is returning an array of strings in that code.
Oh!
Actually, I figured it out
 
uh oh :)
 
var products = #{auto_complete_products.to_json};
I assume .to_json returns a JSON string
You then need to parse that string, to turn it into a JavaScript object/array
 
to_json needs to be met with JSON.parse()
 
\o/
 
7:36 PM
@rlemon yes I was trying that earlier
and I agree
so 'needs to be met'. What does that mean exactly? i need to have .to_json and JSON.parse in the js?
 
var products = $.parseJSON(#{auto_complete_products.to_json}); // Since you're already using jQuery
 
interesting, interesting
let me give that a gander
Same error, cannot convert string into array
I think it may have something to do with the ruby code
(product_names + merchant_names + product_source_image).order(:name)
 
hrmm, i'm beginning to think, in order to get my head around this whole "drupal" thing I shouldn't start with a distribution but the core and just add modules too it?
 
product_source_image is an image...but it's a url, that is returned as a string in the rails console. My friend just told me that when using the + sign you can only have the same type of objects...but wtf, they are all strings...
 
@DavidPardy is it a js error?
 
7:42 PM
No, rails error
cant get localhost to load even
 
lol then why did you think it was to do with your js code?
in the first place
 
because i thought it had something to do with the JSON bit
 
but.... javascript is ignored by Ruby, only the browser cares
 
yeah you are right :x
 
@DavidPardy So here: (product_names + merchant_names + product_source_image).uniq.sort, you're adding together (concatenating) three strings to get one string, and then asking for the uniq values in that string.
I'm guessing uniq only works on arrays, and that's where your error is coming from
 
7:47 PM
yep, I am thinking you are right
one sec here
 
<---- OBVIOUSLY A RUBY MASTER
 
rofl
been doing this for 3 months, yes Ill admit im retarded:)
 
I am starting to learn Ruby
but starting meaning, i've looked on Amazon for some books.... and i've bookmarked the docs page.
 
lols
@RyanKinal that is the trick sir.
Not there yet but on the way
 
7:53 PM
0
Q: Enable Submit Comment Without Page Reload (Using Ajax)?

Aahan KrishWhen user writes a comment and hits the submit button, WordPress reloads the page, before the comment is shown to the user. Is there an Ajax-based solution that allows users to submit questions dynamically, without refreshing the whole page?

 
That feeling when you have to leave a bug unsolved because it's taking too much time :-(
 
@RyanKinal That's what quick and dirty hacks are for.
 
Well, we're actually putting it back out in the wild, just to see if we can get it to re-occur. I've been unable to reproduce it in more controlled circumstances.
Anyway... meeting time.
 
@Esailija Loving the nested case statements.
 
8:34 PM
this i dont get the point of github.com/HPNeo/gmaps
 
finally, a place to complain about other peoples questions in real time!
 
lmfao
wtf?
 
> GMaps.js allows you to use the potential of Google Maps in a simple way. No more extensive documentation or large amount of code.
 
there isnt that much code...
its what one of my apps are based on is gmaps lol
seems like a trivial lib to me =)
 
I don't get why they require 20kb of jquery and then only use $(function() {})
 
8:39 PM
lol, x2
 
And $.extend
 
<3 copy.sh
 
@copy probably because it immediately gains more popularity
 
probably lmao
 
@Mike Thanks
 
8:41 PM
i really dont get it though, im looking at the code and.. its kind of useless
i mean, gmaps isnt that complicated..
 
I actually watched it over the weekend, Ive never dealt with gmaps at all, and it seemed crazy easy to use
 
i know dick shit about js and barely a bit more about jQuery... and i grasped gMaps..
 
@Loktar Really ? Well, not in this room at least
 
it's a good thing someone's forcing you to use it
 
I have to throw some maps on my wifes realestate page so I was going to use it
new GMaps({
  div: '#map',
  lat: -12.043333,
  lng: -77.028333
});
seems dead simple
 
8:42 PM
no they aren't @Jasconius, but they are cluttering up my explore page on github >_>
 
but again, Ive never looked at gmaps... and I already have jQuery included anyway because of backbone.
 
`var map;
function initialize() {
var myOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
myOptions);
}

google.maps.event.addDomListener(window, 'load', initialize);`
thats gmaps
 
heh well ok, that does seem quite easy :P
 
same shit
the one thing this lib has, is geocoding... which is nice not having to rely on yahoo geocode service or another service.. which i do currently.
 
8:56 PM
 
user1385191
writing documentation for closures sure is fun
 
user1385191
 
hmm yes, that seems unplesant
 
user1385191
can anyone ponder a guess as to why that only "works" in IE 7?
 
9:06 PM
@MattMcDonald you mean callbacks?
 
user1385191
no; I mean closures
 
why are you documenting closures?
 
user1385191
/**
* @private
*
* @closure
*
* @description
* Method that returns a closure that wraps the
* specified collection, and converts it to an
* array-like object.
*
* @param collection String
* A string containing the key to access as a
* property of a document node-like object.
*/

function getCollection(
	collection
)
{
	var key = collection;
	return function (doc) {
		var result = null;
		if (isDocument(doc)) {
			result = makeArray(
				doc[key]
			);
		}
		return result;
	};
}
 
that's not a closure
 
user1385191
because every function declaration gets documented
 
9:07 PM
it's a function
 
user1385191
it's used to form a closure
 
user1385191
which then itself gets documented
 
user1385191
/**
* @public `Utils.select.queryAll`.
*
* @closure
*
* @description
* Wrapper method that returns an array-like object
* of node-like objects that match the specified
* "selectors"; returns `null` if not applicable.
*
* @param caller Object
* A node-like object object to access.
*
* @param selectors String
* A string containing the "selectors" to find.
*/

querySelectorAll = (function () {
	var key = "querySelectorAll",
		result = null;
	if (canCallSelectors(doc)) {
		if (isHostObject(doc[key])) {
 
user1385191
there's an example
 
what is that code trying to do
 
9:19 PM
make the documentation a link to this part of the chat log
 
user1385191
if the collection exists, it returns a closure without that isHostObject check
 
user1385191
so it speeds it up
 
so getCollection is like calling [].slice.call( document.links ) ?
but what is this querySelectorAll stuff.. you seem to check at least 3 times if querySelectorAll is supported
 
user1385191
I check once
 
user1385191
then I check if a specific nodeType can use them
 
9:28 PM
you check if document canCallQuerySelectors, then you check if document.querySelectorAll is host object, and then you finally call getQuerySelectorAll with argument "querySelectorAll"
though doc is not defined here
 
user1385191
that's a reference to the current document
 
user1385191
which is used at runtime and discarded
 
user1385191
function getQuerySelectorAll(
	method
)
{
	var key = method;
	return function (caller, selectors) {
		var result = null;
		if (canCallSelectors(caller)) {
			result = makeArray(
				caller[key](selectors)
			);
		}
		return result;
	};
}
 
11:18 PM
evenin folks - any suggestions on how to do this with loops? stackoverflow.com/questions/10889046/…
 
@jamesson, you can at least start with assigning the arrays like this: lSide = [0, 0, a, b]
 
ah, k
 
0
Q: Would 2D game artists prefer to create art using vector graphics?

ParrisI know this might be a preference questions, but it would seem to me that vector art is clearly superior in terms scalability/reusability; however, in most cases I have seen artists using bitmap/rasterized art. Is this a limitation put on the artists by the game programmers/designers? As a progra...

 

« first day (597 days earlier)      last day (4351 days later) »