« first day (1099 days earlier)      last day (3852 days later) » 

3:00 PM
104 it is!!
Thanks! Have an upvote! :)
 
or 91 if you need to go down :-)
 
is that syntax specific to the bot?
i.e. lack of parentheses
on a.push
or is it new
same with the for
 
!! tell danny wiki coffeescript
 
ah I see, thanks! Heard of it but haven't used it before.
 
3:03 PM
!!c>((i if 48776 % i == 0) for i in [2..48776])
 
@JanDvorak 48777
@JanDvorak 48776
@JanDvorak 48776
 
@JanDvorak are you taking a look at my problem?
could you take*
 
@DanCapitanDePlai frankly, I don't even understand what is the desired behavior
 
well, if you have a few minutes i can explain
 
I'll take a look at the live page
 
3:08 PM
you should scroll down to the last product variation
near the price-thing that is auto updating
you'll see that the product over there has a certain price when you buy only one piece, and has tier prices if you buy lots of them
ie
 Compre 10 por R$0,150 cada
if you buy 10 or more than 10
the price goes $0,150
and the total amount you enter in the quantity input
should multiply by 0.150
and if i set the quantity to 100 or 199, the total will be a multiple of 0.150
but if i place 200 in the input box
 
seems to work for me for the last product
 
the price is not being a multiple of 0.150
it works only if you set the quantity lower than 199
 
@JanDvorak n/m
 
if you set the quantity to 200 or more
the price is going mad :))
 
works for 10k
 
3:12 PM
well, it does
but it should work with every number
 
as well as 1k
 
on the last product, 200 * 0.15 comes up to $18
 
yes
that's the problem Danny
 
instead of $30
 
yeah
and I can't understand why that is happening
 
3:13 PM
that said, I don't speak jQuery, only JS, so I can't help
 
I'll fire up the debugger
 
actually, the code looks more like JS than jQ anyway
 
Danny, that means you could take a look also? ^^
 
I'll look too, but Jan will probably get there quicker than me
 
3:14 PM
i thank you both
 
where's the responsible code?
 
0
Q: Autosum / price calculation

DanCapitanDePlaiI have a list of products that have tier prices and a jQuery real-time calculation system. Please take a look at this page and scroll down to the last product option / to the totals. Here are 2 screenshots for a better understanding: The JavaScript looks like this: decorateTable('super-...

 
you can see it immediately under the product variations
on the live page
 
It's using a price of 0.09
 
3:16 PM
@DanCapitanDePlai First, some general feedback: Don't call your variables q or p, use the full name (quantity and price). You also have some html entities int he code.
 
question: why is it more expensive to buy 10 than <10?
 
what's elem.observe?
 
your prices don't make sense
 
It looks a bit like...MooTools was it?
 
1 @ 0.1
2 @ 0.09
3 @ 0.08
10 @ 0.15 < ?????
 
3:18 PM
No, Prototypejs
 
@Ale110 Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@Zirak, thanks for the feedback
@DannyBeckett I know the prices does not have any sense
but the script shouldn't care about this
 
it should just compare the input with the price range where it fits
quantity input*
 
uhh. some functions just compute a bunch of vars and then call another function and discard those vars
 
3:20 PM
tbh, it's not "vanilla enough" for me... the jQuery doesn't mean much to me. Gonna leave this one to others to help
 
Gonna lurk here for a bit
 
thanks anyway Danny
 
any one here able to delete answers on SO ?
 
getTotals is misnamed
 
let me take a look
 
3:21 PM
I suggest updateTotal
 
-1
A: Mysql query group by and php report

user2834739to make sure u get the right query, use the lastest jQuery plug-in Dbase explore. using this, u could construct virtually any query u want, or the engine does this building process for you. u just give it the initial database and the result, then cross-check it with ur expectation, that's all. an...

both the answers in this question
need to be deleted
 
@JanDvorak i will rename it
 
wait, you parse the webpage to reverse-engineer the prices to compare against? WTF?
@Dave #2 is flaggable
 
@JanDvorak, I told you: im using a script taken from the internet
 
@Dave why don't just flag it?
 
3:24 PM
@DanCapitanDePlai it's horrible
 
i know it is, but it seems to partially work
 
the logic is
 
I have but i the jqery answer is there still even tho the question is not about javascript
 
@Dave Just flag them. They'll be deleted very quickly
 
@DannyBeckett Is the first one NAA?
 
3:26 PM
no, only the "what do you want to know" one
the other I'd say is VLQ at best
 
aaand it's gone
 
Aw, I missed the change to RAEG at bad answers
 
tbh the whole question needs to be VTC'd
 
the 2nd one the user seems to think query auto means jquery if i read his comment response correctly
 
3:26 PM
@DanCapitanDePlai Without access to the script, the only suggestion I can really give is to add logs. console.log(q, p), see what happens, console.log where you turn them into integers, and so forth. Add logs at every stage, see at which point it goes to hell.
Also, log your conversion ratios (10+ means price x), maybe you got that part wrong.
 
@Dave it also means "question" if you happen to be an Indian
 
@Zirak thanks. I've never really debugged javascript ( i use firebug ) but it's the perfect time to start
 
!!> Number.isNan("")
 
@JanDvorak "ReferenceError: isNan is not defined"
@JanDvorak "TypeError: Number.isNan is not a function"
 
isNaN
 
3:28 PM
@DanCapitanDePlai firefox user ? you guys still exist :O
 
@Dave, seems so :)
 
!!> Number.isNaN("")
 
@DannyBeckett false
 
Mistyped :-/
 
wat
!!> Number.isNaN === isNaN
 
3:29 PM
@Zirak false
 
Bitch yeah
Number.isNaN actually tests for NaN, no internal Number conversion
 
!!>+""
 
@JanDvorak 0
 
!!>+()
 
@DannyBeckett "SyntaxError: syntax error"
 
3:30 PM
!!>+function(){}
 
anyone a star citizen backer?
 
@DannyBeckett "ReferenceError: isNan is not defined"
@DannyBeckett "ReferenceError: alert is not defined"
@DannyBeckett "NaN"
 
Ok, I understand there are lots of errors so you can't provide me a quick fix
I am going to try and write another script by myself
 
guys i have competed java script track from codecademy , is there any website that teaches well "how to use api's" ?
 
after I try debugging this one
 
3:32 PM
lol I like that last one! Coerce a function to a number... get NaN :p
 
thanks a lot for the hints guys
 
most sites that have API's will have documentation @VamsiPavanMahesh
 
@DanCapitanDePlai Good luck
 
^ what Dave said
 
@Dave: i mean just for practicing , will there be proper documentation for beginners to understand ?
 
3:34 PM
@VamsiPavanMahesh You need to pick an API
 
@VamsiPavanMahesh That question is one of the most general things I've heard. An API is any sort of abstraction - the DOM is an API, the window object is an API, so many things.
 
what API are you using ?
 
So "practicing using an API" is "doing any sort of programming", really.
 
was a brave question to ask in this room for sure :P
you got off lightly it seems :P
 
i have not tried anything in API's yet , so asking @Zirak
 
3:35 PM
The Dropbox API was a bitch, but they recently made a new version that looks promising... try making something with that
 
@VamsiPavanMahesh what kind of API do you need?
 
There's no such thing as "practising using an API". Well, there is, but it's called "programming". So don't give it another thought.
 
like xkcd ? @Ale110
 
...Well, afaik xkcd doesn't have an API :)
 
3:37 PM
They do, actually xkcd.com/json.html
 
okay i'd like to "program" ,pull some data from website , which API would you recommend to a beginner
@Zirak
 
There's no difference
Just...pick some goal.
An API is a tool, don't make it an end.
 
what website @VamsiPavanMahesh ?
 
@Zirak :O nice
 
@VamsiPavanMahesh one that doesn't require you to sign up for an API key
 
3:38 PM
@Shmiddty You taste just like raisin.
 
alright, this is just getting painful. gnome-terminal doesn't come installed by default.
 
i am asking you guys to recommend @Dave
 
!!c> console.log i for i in [2..48776] when 48776%i == 0
 
@JanDvorak "undefined" Logged: 2,4,7,8,13,14,26,28,52,56,67,91,104,134,182,268,364,469,536,728,871,938,1742,18‌​76,3484,3752,6097,6968,12194,24388,48776
 
@VamsiPavanMahesh an API is a concept. What website do you want to get data from?
 
3:39 PM
@VamsiPavanMahesh unless you have a reason to pull sumin off a website just focus on more important JS aspects first that you actually -need-
 
!!> [].map.call(0..toFixed(48776),(a,i)=>i).filter(a=>48776%a==0)
 
@Shmiddty "RangeError: precision 48776 out of range"
 
lets say i want to pull current trending videos of youtube per each hour on a language @Dave
 
@VamsiPavanMahesh have you read this en.wikipedia.org/wiki/Application_programming_interface
 
@VamsiPavanMahesh What you're saying is "I want to learn how to ride a bike, can someone tell me how to turn the handle?" Start riding the bike, then you'll learn how to turn the handle.
 
3:41 PM
it has code examples too ^
i suspect if you just learnt from Code Academy youll find it overy complicated
 
@Zirak it's more like "I want to learn how to ride a bike, can somebody tell me where should I go for a ride?"
 
if i were you i would recommend a 125 cc bike rather than a hayabusa ,@Zirak
you translate the above statement in API for a beginner @Zirak
 
GAH
 
ok "take driving lessons or youll crash and die"
thats what you tell a beginner
 
An API is a tool, it's a means, it's not a goal
 
3:44 PM
!!> Array.apply(null, Array(48777)).map((a,i)=>i).filter(a=>48776%a==0)
 
@JanDvorak [1,2,4,7,8,13,14,26,28,52,56,67,91,104,134,182,268,364,469,536,728,871,938,1742‌​,1876,3484,3752,6097,6968,12194,24388]
@JanDvorak [1,2,4,7,8,13,14,26,28,52,56,67,91,104,134,182,268,364,469,536,728,871,938,1742‌​,1876,3484,3752,6097,6968,12194,24388,48776]
 
There is a HUGE difference between an API and a bike. Once you want to get somewhere, THEN we can maybe recommend the different ways to get there.
 
@Dave: where to take those lessons ?
 
i gave you a link with youtube api example scripts
 
But you haven't said what you want to do with the tool
Start writing programs, work on projects, do fun things. I promise you you'll encounter more APIs than you can imagine.
 
3:46 PM
i want some data to be pulled @Zirak, since i have not done anything like that , i approached this
 
Don't approach it like this, it's the wrong way to approach it.
 
chat room
 
So you have data...so what? What do you want to do with it?
 
okay , pls tell me the way
 
Data is friggin meaningless without usage, without purpose, without cause.
THE WAY TO WHAT!?
 
3:47 PM
Amarillo.
 
the way to javascript to a person who completed codecademt tracj
*track
 
gives up
 
the way to javascript ?
 
How do i js? :)
 
i've learnt that code academy doesn't seem to be very good ;p
 
3:48 PM
where did you learn @Dave
 
i found example scripts and fiddled with them
others use books
 
@VamsiPavanMahesh just come up with an idea and make your webapp
 
coming in theatres soon: everything wrong with codecademy javascript tutorial
 
books is probably best to avoid picking up bad habits from example scripts
 
@Dave book authors also have bad habits
 
3:50 PM
well not if you get a highly recommended book
 
so what book do you recommend @Dave
 
user1125394
how you match the last word, without an optionnal '?' ?
 
user1125394
!!> 'how old is JC?'.match(/[^ ]*(\??)$/)
 
@cc ["JC?"]
@cc ["JC?","undefined"]
 
@VamsiPavanMahesh i didnt learn from books so no point asking me
 
3:54 PM
@cc ["JC?",""]
 
@cc the opposite of backreference... I can't remember the name right now
 
user1125394
front references :), k let me search
 
!!> 'how old is JC?'.match(/(\w+\s*)$/)
 
@Ale110 "SyntaxError: invalid regular expression flag w"
@Ale110 null
@Ale110 ["how ","how "]
@Ale110 null
 
3:57 PM
Well, I really suck at regexps
 
!!c>a=[]; (a.push i if 31861 % i == 0) for i in [2..31861];
 
@DannyBeckett 3
 
3?! that's it? @JanDvorak
!!c>a=[]; (a.push i if 31860 % i == 0) for i in [2..31860];
 
@DannyBeckett 47
 
hmmm
!!c>a=[]; (a.push i if 31859 % i == 0) for i in [2..31859];
 
3:59 PM
@DannyBeckett 1
 
!!c>a=[]; (a.push i if 31858 % i == 0) for i in [2..31858];
 
@DannyBeckett 7
 

« first day (1099 days earlier)      last day (3852 days later) »