« first day (650 days earlier)      last day (4308 days later) » 

12:01 AM
@hhh JSON.parse in all modern browsers. I think Crockford wrote a normalizer for IE8 and lower.
But that wouldn't turn it into a DOM object. Just a normal JavaScript object.
I'm assuming you get the JSON from an ajax request as a string and want to convert it to an object in JavaScript.
 
hhh
@ErikReppen var test=JSON.parse('http://127.0.0.1:5984/test/_all_docs?include_docs=true')

SyntaxError: Unexpected token h
 
12:16 AM
@hhh You need to parse the contents of the file, not the URL
 
hhh
@Dennis I cannot understand where the file is
 
12:40 AM
anyone know how to make a function that detects if dynamically loaded images are loaded?
I have a function for loading images, and I want that function to store a function in... nevermind
I just answered my own question :)
anyone know how to name a function after the value of a variable?
0
Q: How can I name a function after the value of a variable?

TgwizmanI have a function that allows you to load a new image. I want that function to make a function that detects when that image is loaded, and store it in an array or object. I have another function that will go through the array or object, and check each to see if it's loaded. My question is, how c...

 
1:01 AM
@hhh you ajax with the url, then take the returned contents and parse those.
Okay, IE8 'not implemented'
Happens when I fire a function that is defined with empty strings as arguments. I commented out everything inside the definition. Same error.
I tried using the same arg vars in an undefined function and got a different error.
So wtf?
 
hello anyone, can you help me to here >> jsfiddle.net/xKJn8/8
I want to count some items in specific condition by looping...
but I get confuse with the looping how to add +1 every time it loops
here is what I've made so far >> jsfiddle.net/xKJn8/8
 
tl;dr... what is the problem?
you should probably clean up your code a bit :S
 
1
Q: JavaScript function to get DOM elements by any attribute

John HI needed to write a function today in JavaScript that would return all elements based on a given attribute. e.g retrieve all elements that have an id attribute in them. The function I wrote for this is as follows: function getElements(attrib) { // get all dom elements var elements = ...

 
1:20 AM
@Tgwizman yeah, my code seems to be messy :p
the problem is I can't get the value how many times the loops in every currtipe
@Tgwizman basically I want to count how many loops in each currtipe then store that count result in arrays SumByTipe[currtipe]['isi'] jsfiddle.net/xKJn8/8
 
array.length
what do you mean by, "loops"
and give me an example as a purpose for the code, to help me understand what you are trying to do
 
@Tgwizman for example: I have 2 tipe called ESL and UHT
in 'tipe' called ESL there is 5 items and in UHT have 4 items.
how do I know how many items in each tipe
in my case all items show in json array
 
1:35 AM
for (each in array) {
    for (each in eachArray) {
    }
}
switch array with object or vice versa
 
@Tgwizman about the loops, I've create the loops to summing that items but I don't know how to count how many items that summed
 
i = 0;
for (each in blah) {
    if (whatever) {
        i++;
    } else if (whatever) {
        i--;
    }
}
it's all interchangable... that's the nature or javascript
 
@Tgwizman okay I'll try that and give my feedback :)
 
:)
 
@Tgwizman I've update my work, but it always get 0 :(
 
1:49 AM
take another look at your code to see if your doing something wrong or making a common mistake
 
okay
well, I still don't get how to add the value into my new arrays
I mean like this: e.g. in tipe ESL there are 5 mc (agen, Institution, Lower Trade, Modern Market, and Hotel & restaurant). so if I want to know how many mc in each tipe I can call them like CountResult['ESL'], CountResult['UHT'], and so on..
 
you have to throw all their counts in another array
count them all by specifically filtering the results
 
so after I can put the count result in CountResult[] I can simply call CountResult['ESL'] to show how many mc (in this case it will show 5)
 
mainly if/then/else and/or for and/or switch/case
 
hi all, quick question that I can't find a straight forward answer to online.
 
2:00 AM
put the name of each array as the key in the new array
 
How can I make a chainable function in javascript. Like the .trim() in myString.trim() is chainable.
 
array = [];
object1 = {
    'foo': ['bar', 'foo', 'bar', 0],
    'blah': 0
};
array.push(count(object['foo']));
 
@Tgwizman okay, I will try that one :) thanks
 
you don't need that. just make a parsing function, then spit the result into the array
or make the array into an object, and put the name of the current object you're parsing as the key to the value
it would be like:
ojbectCountHoldThing['object1.foo'] = countOfbar; // 2
or change the array to a javascript hash table (ish) thing
array['rawr'] = blah
 
I still didn't get it :(
I'm sorry because I'm new in programming :'(
 
2:09 AM
it's ok :)
you'll get it eventually
 
@Tgwizman I've update my work again but this time it has count the wrong items jsfiddle.net/xKJn8/12
 
put it up as a question
 
I've just put it as question here stackoverflow.com/questions/11680334/…
 
have you tried using console.log();?
it logs whatever you tell it to log
array / object / or string
 
not yet, but I've try console.debug()
 
2:11 AM
or even an anonymous function that is stored by a variable :)
eww
 
eww..it has count in the wrong items
it counts the items in ESL not count mc in ESL
but I still don't know how to do that
 
you learn from experience, not from me telling you how to do things :P
 
I want that too..but now I need it Immediately :(
 
2:35 AM
@Tgwizman almost get it but it still count the wrong items :(( jsfiddle.net/xKJn8/16
please help me just once :((
 
fine... :((
 
@Tgwizman I'm sorry :(
 
it's all good :P
what are you hoping the value will be?
and what is it giving you currently?
 
@Tgwizman what I need is to count how many mc in ESL (the result should be 5 mcs (agen, Institution, Lower Trade, Modern Market, and Hotel & restaurant).
 
and which variable are we talking about?
how are you looking for said results?
 
2:37 AM
@Tgwizman but it count the wrong items, it counts how many items in ESL (it shows 15),
@Tgwizman the variables that we're talking are how many mc in each tipe
 
are you trying to separate numbers from strings?
what is mc?
and how does mc relate to hotels, restaurants, institutions, etc?
you must let the computer know what this all means too :S
 
@Tgwizman well the result should be in array like CountResult['ESL'], CountResult['UHT'], and so on, then when I call them it shows the count result of 'mc' in each tipe
@Tgwizman I'm sorry can't explain clear, but wait a minute..I will draw what I mean
sorry about my bad english :p
 
when you say "tipe", do you mean type?
I'm just rewriting the whole thing for you :P
it's a few lines ^-^
 
@Tgwizman here is what I need, I just upload my drawing
@Tgwizman "tipe" in my case is equals with "type" but in my json object it called "tipe"
@Tgwizman rewriting my what? :0
 
2:53 AM
ohh... so you want a count of that?
shall I rewrite the entire thing for you? :P
the way you are storing it all is very odd
group the data by the name, not randomly in an array ;)
or do you need it as such?
 
@Tgwizman If it necessary and if you will :p it will very helpful if you do so I can learn another way :D
 
cool ;D
 
@Tgwizman yeah I create that to summing the items (not the mc) in each tipe
@Tgwizman I thought it will be same like what I did previously (the summing things)
 
the way you're currently doing it is not very easy to work with
the table is organized like it is for a reason
there is a group, mc, and below it is a list of whatever
within each list of whatever, there are values for each
wait...
isn't there five mc in each tipe? .-.
and they all are the same :S
is it always this way?
@blankon91 I have the fix for you :)
http://jsfiddle.net/T4wk4/
this is somehow relevant to the chat threewordphrase.com/heaven.htm :P
 
3:18 AM
@Tgwizman not, it's not always 5
 
you can simple throw values in with data['ESL'].push('HI MOM');
that was just to make things quick on my end :P
It sounds like you are transferring data types to the computer, and having to count specifics
 
@Tgwizman yeah..
@Tgwizman btw, thank you very much for your help, now I will modify it so it can show the array from my json
 
you can also get the lengths by doing data['ESL'].length
 
@Tgwizman LOL
 
yes?
ohh... :P
 
3:22 AM
@Tgwizman yes
 
xD
it's relevant... trust me ;D
this one is also relevant threewordphrase.com/whoaman.htm
 
@Tgwizman :D absolutely LOL haha
 
3:39 AM
the chat is soo dead o.o
 
@Tgwizman sorry I just finish my work
 
it's k :P
 
and the result is.......*drum backsound*
IT SOLVED!! yippie...
@Tgwizman it because of your help dude
here is my update jsfiddle.net/xKJn8/18
 
:D
 
and that's the exactly what I need :D
 
3:42 AM
not exactly what I had in mind, but cool :D
 
@Tgwizman your last jsfiddle just give me so much inspiration to understand it
 
as long as it works for anyone who uses it, well done :)
ahh
glad to be of help :)
 
@Tgwizman haha yeay..thank you very much my friend :D
@Tgwizman maybe you can put your answer to my question stackoverflow.com/questions/11680334/…
 
np :P
 
so I can give you more points :D
@Tgwizman finally I get it..it just like what you said before :D
 
3:44 AM
^-^
I posted my answer
it's at the bottom
 
damn, I love this web and the people inside
@Tgwizman okay, rep. points comes
 
xD
:D
 
marked :D
 
doctors in real life .-. threewordphrase.com/badnews.htm
 
@Tgwizman damn, so LOL :D haha
 
3:50 AM
this one is just odd >.> threewordphrase.com/brofight.htm
 
@Tgwizman what a guy..I don't want have a problem with that guy :$
 
:S
 
btw, you know what, you just give my the last piece of my jigsaw puzzle haha
and now I can continue my work again yeaaay :D
 
@Tgwizman poor lady LOL :D
 
3:54 AM
;)
 
where's everybody go? it's so quite here, just you and me
LOL
 
^
false alarmmm.... this is more of a LOL threewordphrase.com/justsupergood.htm
that's the environmentally conscience pirate
 
4:17 AM
@Tgwizman haha LOL :D
@Tgwizman what a pirate :p
 
:P
 
@Tgwizman I've bad news about my work again
 
which would be?
 
there is another parameter to count them
there's not mc that should be count, but cm_per1 and cm_per2
i need to count how many cm_per1 and cm_per2 != '0'
so If there is 5 mc, but in 'Hotel' there is cm_per1 has value 0 so 'Hotel' shouldn't be counted
and the result should be 4 (because the 'Hotel' has 0 in 'cm_per1')
 
so add another if/then to look out for any 'cm_per1's, then make another counting variable
 
4:25 AM
ok I'll try to do that, but i need to go, and I'll be back terminator sound B]
 
hey all
 
5:04 AM
@Tgwizman nice one....
 
5:17 AM
@hi, all anybody has worked with indexedDB
 
5:49 AM
Hi
any one there??
 
6:15 AM
<<<<<<<<<<<<yrp
Morning guys:)
 
@Tgwizman ahoy haha I'm back
@AndersMetnik morning :)
 
6:47 AM
wut
got a silver badge on programmers.se
 
gratz
 
@FlorianMargaine congrats :D
 
@Raynos which is why people are telling you it's nice when you provide some boilerplate? :)
 
@FlorianMargaine some guy asked me to do a jsfiddle with my things for the googlemap issue, how do i "upload" the rest of the scripts so it works? :)
 
@AndersMetnik you have a resources tab on the left
 
7:09 AM
I get confuse to count how many objects that have 0.0 value in my array, anyone have any idea how to do that? jsfiddle.net/xKJn8/24
 
var count = 0;
arr.forEach( function( el ) {
    if ( el === 0.0 ) count++;
});
 
@FlorianMargaine okay, I'll try that one..thank you :D
 
hi
i have problem
i have javascript counter
timer
and i do not how to stop the timer
I have used setInterval
but window window.clearInterval does not wor for it
could someone help
 
but if I want to add the `count` as array..btw, in case should it like this? var count = 0;
data.MyData[i].forEach( function( cm_per1 ) {
if ( cm_per1 === 0.0 ) count++;
});
because it doesn't show the value :(
I want to add the count value just like if (!final_results[type]) {
final_results[type] = {
"cm_per1": [],
"cm_per2": []
};
}
@FlorianMargaine so in final_results['ESL']['cm_per1'] there are {"0.0","0.0","0.0"} and I can count it with final_results['ESL']['cm_per1'].length just like this one jsfiddle.net/xKJn8/18
 
7:32 AM
I've create my question of my problem >> stackoverflow.com/questions/11683301/… someone please help me
 
@blankon91 answered :)
 
@FlorianMargaine thank you for the answer but wait, :)
 
yeah got it
I'm editing
 
@FlorianMargaine okay :D thank you
@FlorianMargaine your first answer is close enough to get what I need, I just put 2 variables (count_1 and count_2) but the problem is I need it as array..that's what makes me confuse
 
@blankon91 edited
 
7:44 AM
@FlorianMargaine thank you, that's just what I need..thank you very much :D
 
you're welcome
upvote and accept the answer, that'll be my thanks :)
 
accepted and upvoted :D
 
8:04 AM
am I the only one to think like this?
0
A: how can I know the element is the last item?

Florian MargaineThe most efficient is to have a last class assigned to it when it's rendered on the server. This way, a simple, cheap and efficient $( this ).hasClass( 'last' ) will be enough. Example: <ul> <li></li> <li></li> <li></li> <li class="l...

 
$("li").is( ':last-child') is O(n²)
for each li, you need to iterate all it's siblings to find out if its the last child
or maybe it's optimized with li.parentNode.lastChild === li
 
but at least that's for nth-child
 
yup
thanks, I'm not the only one
@Esailija lastElementChild
oh
my bad
 
case "last":
while ((node = node.nextSibling)) {
    if (node.nodeType === 1) {
        return false;
    }
}
return true;
it's optimized
it does only one iteration
or two at most
 
8:09 AM
oh
nice
yeah maybe more if there are some html comments :p
 
I did jsperf sometime
native query selector last-child was slower than jQuery extension :last
 
heh
guess QSA is badly implemented
 
Should'nt lastElementChild or the setting class to the last element be the fastest?
 
florian it is a css selector
dude
:last-child
 
8:15 AM
it's not in css
 
what do you mean
it doesn't use jQuery in browsers that support QSA
 
> last-child is not a css selector by itself there
 
what does that mean
 
css selector = in css files for me
 
the case "last": thing is only ran for IE7
otherwise it uses QSA because :last-child is native selector
 
8:17 AM
oh :|
 
generally the :child selectors are terrible
 
@FlorianMargaine But it wont let me upload, only link, i dont have the scripts on the net..
 
can't help you then
put them on gist or something
 
gist? :)
@FlorianMargaine in fiddle, the javascript field is automatically included to the html field right?
 
8:37 AM
@FlorianMargaine upvote pls stackoverflow.com/a/11684203/995876
the other answers suck and I am too close to them
 
helped ya a bit :)
 
thx ;d
 
o/
@FlorianMargaine have a nice last day of work ;)
 
thanks :D
not much to do
my replacement is doing everything for me hahaha
 
8:52 AM
just have to look over his shoulders? :D
 
nah... it's ok
 
"Don't surf StackOverflow during work! It's the devil!"
 
he's doing fine
he's seeing my screen though, can't say that :D
but he's not proficient enough in english to go on SO like I do tho :|
 
:D
well, my english isn't good, that doesn't stop me, does it? :D
 
your english is way better than his
he can't talk in this chat
and your english is really good
heh, he's always on google translate :x
it's kinda a pain because the codebase we're working on has comments in english
 
8:58 AM
well, it's a good chance to learn then
 
how to cancel a close vote?
0
Q: JavaScript templating tool

DotNET NinjaRecently I found a powerful approach to generate HTML content right on the client side - templating. Sorry for such abstract question but as I'm very new in this topic and I'd like to know pluses and minuses of any JS (jQuery) templating tools like jQuery Template, JS Render or may be any another...

i close voted this for not constructive
I'd like to migrate it to programmers.se actually
 
ThiefMaster or another mod around?
 
> jQote2 is the second major release of jQuery’s most powerful and versatile client-side templating engine.
okay, you're out
 
> If you like to have sex while listening to music, always choose a live album. That way, you'll get applause every 3 to 4 minutes.
@FlorianMargaine ^
 
saw this pic on 9gag a few days ago
it was a tweet from I don't know who
and @Zirak, why me? WHY? KANT I HAZ NO PRIVATE LIFE?!
 
9:12 AM
...the cameras in the bathroom are not mine
 
... damn, you saw me and my dog?!
 
I don't understand one thing...why did Captain Crunch have to suffer?
 
@Zirak maybe you could ask a question on SO about this?
> CoffeeScript - Incredible javascript compiler. Everything just seems to work better with coffeescript.
brrrr
 
@OctavianDamiean i like how that page breaks in opera :D
 
9:26 AM
Screw Opera. :D
 
haha, no really, what the hell did they do
the slider isn't working, if i click on an icon in the list, only the overlay-background appears and after i close that one again, nothings clickable anymore
 
That must be a bootstrap bug I guess.
 
how do you even manage to make a simple page break that bad in a relatively modern browser :D
 
But not all icons are clear, the twitter icon for example is not clean...
 
there's an "icon-lemon"
hehe
 
9:29 AM
yay
 
i'm still amused by that
 
Morning all
 
now i can see, why opera has to make decisions like implementing -webkit and browser.js
though stuff is still messed up
should i file an issue on github? :P
 
I am saving few DateTime in a table, I have a timer job that will keep looking in table and see if there is any DateTime that passed over 2 hours

my logic is

if (DateTime.Now > DateTime.Parse(rdr["TimeItemAdded"].ToString()).AddHours(2))

but seems like complicated to me and am confused
 
"Your page is totally screwed up in opera"
First reply would probably be: "What the hell do I care"
 
9:33 AM
is installing Opera to find out what everyone is talking about
 
??
anyone with sharp mind
@FlorianMargaine ?
 
@OctavianDamiean everyone = gni33? :<
 
I see, Opera is being a bitch. Nothing new.
 
heloo hellooo delllo dello ?
 
@fdgfdgsdfg What's DateTime? It doesn't exist in native js
You can't write C# in js
Well, you can, but it just won't work
 
9:48 AM
Hello mustache brother.
 
ahoy
 
Does anybody know how does stackoverflow achieve it's chat room feature
Does anybody know how does stackoverflow achieve it's chat room feature
 
What chat room feature?
 
How? They wrote code
 
Mainly, yea.
 
9:51 AM
the function we are using now
by flash?
 
That's usually how programming tasks are achieved
You can view-source for the client-side
 
No, not flash.
 
Flash is only used for the pinging sound
 
When I send this message to server, then how does server send this message to browser?
 
jPlayer uses html5 with flash fallback
I doubt anyone is here without html5 support
:P
 
9:55 AM
Well, overly simplified your browser (client) subscribed to the server (server) for getting any updates (messages).
 
Or browser have requests in a regular cycle
 
why? who isn't on IE7 here?
 
lol
 
That is one way, I actually don't really know how exactly this chat has been implemented.
 
as always the standard apis suck so jPlayer is also a worthwhile abstraction
it has a solid socket connection to the server
 
9:56 AM
Chat now uses sockets if support is enabled, otherwise they use polling
 
See, told you.
 
really? why don't they just fallback to flash sockets
:I
wait, new messages still go through http?
 
yeah
 
any time I write a new message, a new POST request is made
lol
 
9:57 AM
It's pretty odd shit
I don't know what they're smoking
 

« first day (650 days earlier)      last day (4308 days later) »