|
Maluco Marinero posted:Can you access the HTML for the survey? Using HTML5 attributes will cover most of the modern browsers. That I guess depends on what you expect your users' browsers to be. You have analytics on this from previous surveys? I just tried this and it didn't work. Here's a screenshot of the editing box to show what I'm working with:
|
# ? Feb 2, 2013 18:12 |
|
|
# ? Jun 1, 2024 05:53 |
|
Borderview posted:I just tried this and it didn't work. Here's a screenshot of the editing box to show what I'm working with: Try this: code:
This should work in place of non-HTML5 browsers. Video Nasty fucked around with this message at 18:51 on Feb 2, 2013 |
# ? Feb 2, 2013 18:43 |
|
Jake Blues posted:Try this: Hmm... that didn't work either. Although, the example on that site is exactly what I'm after. I just dug up this code in their knowledge base that seems to work ( why didn't I look there first!?): code:
|
# ? Feb 2, 2013 19:08 |
|
Borderview posted:Hmm... that didn't work either. Although, the example on that site is exactly what I'm after. I just dug up this code in their knowledge base that seems to work ( why didn't I look there first!?): Can you edit the CSS (styles/style sheets) of the site? That could be a better solution. If not, this should work (I assume that $ is just document.getElementById, juding from the usage of InputId) JavaScript code:
|
# ? Feb 2, 2013 20:38 |
|
Wheany posted:Can you edit the CSS (styles/style sheets) of the site? That could be a better solution. If not, this should work (I assume that $ is just document.getElementById, juding from the usage of InputId) Awesome. That worked! Thanks so much. Yeah, there is an option to "add Custom CSS" or to pull it from an external website. That probably goes way beyond my already non-existent skills, though. At some point I'm planning on taking a class on this stuff just so I understand the basics of it.
|
# ? Feb 2, 2013 20:54 |
|
Borderview posted:Awesome. That worked! Thanks so much. Yeah, there is an option to "add Custom CSS" or to pull it from an external website. That probably goes way beyond my already non-existent skills, though. At some point I'm planning on taking a class on this stuff just so I understand the basics of it. Well, here are the basics for your current task: CSS code:
This doesn't work on IE below 8, but gently caress'em.
|
# ? Feb 2, 2013 21:32 |
|
Wheany posted:Well, here are the basics for your current task: Ah.. way easier. Thanks!
|
# ? Feb 2, 2013 21:58 |
|
Hey, I use a display screen on an HTPC to display media information for winamp with the plug-in browseamp. I'm in the process of building a control interface, but I'm running into some difficulty with the javascript. I'm attempting to have the song position and time remaining called and displayed in text without the need to refresh the page. So far I have:code:
code:
|
# ? Feb 3, 2013 09:31 |
|
I'm working on an app where the user traverses a force graph that is generated from a web search query. Is D3.js the best option for a dynamically created force graph? It seems most of the D3 examples are static data tables loaded in on initialization rather than being added over time. In this app the graph is primarily used as a navigation method rather than a data visualization. I'm having trouble moving beyond example code because I don't totally grasp the functionality since it seems like D3 can be used to make 1000 different types of crazy graphs. Is there a better, force graph specific option out there?
|
# ? Feb 4, 2013 17:35 |
|
Jim Jones posted:Hey, I use a display screen on an HTPC to display media information for winamp with the plug-in browseamp. I'm in the process of building a control interface, but I'm running into some difficulty with the javascript. I'm attempting to have the song position and time remaining called and displayed in text without the need to refresh the page. So far I have: So you're wondering how to change text through DOM? If your HTML is like this: code:
code:
LeCron James fucked around with this message at 18:51 on Feb 4, 2013 |
# ? Feb 4, 2013 18:48 |
|
LeCron James posted:So you're wondering how to change text through DOM? Okay so I have: code:
Edit: Or I need to have the js code which outputs for example <#SongPositionMin> refresh every second without refreshing the page. Praxis Prion fucked around with this message at 22:12 on Feb 4, 2013 |
# ? Feb 4, 2013 21:46 |
|
Jim Jones posted:Okay so I have: code:
|
# ? Feb 4, 2013 23:08 |
|
Learning JS, so heres my amateur view. If I understand correctly, the the script will: Page refreshes for every song Displays remaining time, total song length and current time position Current time and remaining time are updated AJAX style Web server fills in template variables then sends the data to the browser So what I would do, is at the start of your script, set a variable that holds the entire song length in seconds (<#SongTotalSec>) and then set the current time (<#SongPositionMin> * 60 + <#SongPositionSec>) and set your remaining time. code:
code:
code:
With this approach, you can set your HTML to how it was code:
Bobbin Threadbear fucked around with this message at 23:40 on Feb 4, 2013 |
# ? Feb 4, 2013 23:18 |
|
That'd probably work fine for you. You could also have a condition in your time update function that reloads the page when it notices that the time has run out. You should also make sure the server is inserting time without zeros padding it because 09 will be interpreted as octal. That's why I had it parsing strings and forcing base 10 - I'm just used to being defensive about number formats in JS.
|
# ? Feb 4, 2013 23:40 |
|
Munkeymon posted:That'd probably work fine for you. You could also have a condition in your time update function that reloads the page when it notices that the time has run out. Yeah, this is important. Always set your parseInts base! I just fixed that, thanks.
|
# ? Feb 4, 2013 23:43 |
|
Bobbin - I got your script to work, but I have a question. Assuming a song is less than 10 minutes long, how would I add a 0 in the tens position for elapsed and remaining time, as well as the tens position in seconds. In other words, I need a continuous ##:## format for time elapsed and time remaining like a clock would display. Thanks for the help guys! Praxis Prion fucked around with this message at 01:53 on Feb 5, 2013 |
# ? Feb 5, 2013 01:48 |
|
You could do something likecode:
|
# ? Feb 5, 2013 02:56 |
|
Bobbin Threadbear posted:You could do something like Okay great! So I have code:
|
# ? Feb 5, 2013 03:38 |
|
You need to pad the "remainingTime % 60" expression.
Bobbin Threadbear fucked around with this message at 07:34 on Feb 5, 2013 |
# ? Feb 5, 2013 07:25 |
|
Bobbin Threadbear posted:
I call the same function pad10 and it's probably one of my most copy-pasted pieces of code.
|
# ? Feb 5, 2013 10:00 |
|
code:
Munkeymon fucked around with this message at 16:26 on Feb 5, 2013 |
# ? Feb 5, 2013 16:11 |
|
Wheany posted:I call the same function pad10 and it's probably one of my most copy-pasted pieces of code. Simplicity is beauty
|
# ? Feb 6, 2013 01:00 |
|
What is the best way to make basic calculations with money in JavaScript, without ridiculous stuff like losing cents? It seems the moment you use lots of discounts and tax calculations, all the possible stuff that can go wrong with float values go wrong.
|
# ? Feb 7, 2013 17:09 |
|
Tei posted:What is the best way to make basic calculations with money in JavaScript, without ridiculous stuff like losing cents? It seems the moment you use lots of discounts and tax calculations, all the possible stuff that can go wrong with float values go wrong. Do everything in regular integers that represent 1/100 of a cent. Use formatting functions to display things to that they look right.
|
# ? Feb 7, 2013 18:16 |
|
Munkeymon posted:Do everything in regular integers that represent 1/100 of a cent. Use formatting functions to display things to that they look right. Thanks! thats simple enough, It looks foolproff.
|
# ? Feb 7, 2013 19:01 |
|
My Rhythmic Crotch posted:I've actually been evaluating Ext JS at the same time as Kendo. It does seem very mature, but I'm basically a one-man-band developing the entire site, and the learning curve for Ext JS is really putting me off. Perhaps I will just have to stick with it. I use ExtJS and I absolutely love it. I hope someone eventually makes a Sencha megathread. I haven't had the time to do it right. The learning curve is indeed a bit steep, but that often can be attributed to people not knowing CSS or how to use browser web developer/debugger tools. Often when people try to learn ExtJS they are actually trying to learn multiple things at one time, and they tend to bundle all their difficulties into one "ExtJS is really hard" package.
|
# ? Feb 7, 2013 19:28 |
|
Munkeymon posted:Do everything in regular integers that represent 1/100 of a cent. Use formatting functions to display things to that they look right. Couldn't you still end up with erroneous behaviour since all numbers in JavaScript are floats?
|
# ? Feb 7, 2013 20:38 |
|
Optimus Prime Ribs posted:Couldn't you still end up with erroneous behaviour since all numbers in JavaScript are floats? Only if you use a decimal somewhere in your calculations. Or run into the upper limit, but that's 2^1023, which is a hell of a lot of money even when dealing with 100ths of a cent. I'm guessing people aren't going to be calculating the hypothetical national debt of the United States in 2000 years in whatever page he's writing. Munkeymon fucked around with this message at 22:13 on Feb 7, 2013 |
# ? Feb 7, 2013 22:06 |
|
I think the relevant limit would be 2^53 / 10^4 or about $900 billion, and any operation other than addition or subtraction is going to introduce trailing digits that could still affect the result if the calculations are long enough.
|
# ? Feb 8, 2013 05:37 |
|
Gazpacho posted:I think the relevant limit would be 2^53 / 10^4 or about $900 billion, and any operation other than addition or subtraction is going to introduce trailing digits that could still affect the result if the calculations are long enough. You're partially right - I misread the limits, but it's not a matter of introducing trailing digits and any operation will be wrong: code:
|
# ? Feb 8, 2013 16:29 |
|
Ah, okay. So floating points won't give inaccurate values if you treat them as integers? That only happens when decimals are used (e.g. 0.3*3)?
|
# ? Feb 8, 2013 17:42 |
|
As Gazpacho mentioned above, an integer value that falls within 2^53 can be represented exactly as a double. This is due to how the IEEE specification works, there's 53bits for a base, and then 10 for exponent, and one for sign. So with an exponent of 1, you can have exact values for -2^53 - 2^53.
|
# ? Feb 8, 2013 20:25 |
|
I don't see how moving from cents to hundredths of cents improves anything at all and if it does I'd wonder if you are carrying out the calculations in the wrong order. It might be useful to talk with someone who has an accounting background about how these particular calculations should be done from their point of view.
Gazpacho fucked around with this message at 21:40 on Feb 8, 2013 |
# ? Feb 8, 2013 21:24 |
|
Gazpacho posted:I don't see how moving from cents to hundredths of cents improves anything at all and if it does I'd wonder if you are carrying out the calculations in the wrong order. It might be useful to talk with someone who has an accounting background about how these particular calculations should be done from their point of view. It's because using integers to represent hundredths of a cent eliminates floating point representation problems (at reasonable scales) while retaining a good bit of precision (as long as you're careful not to divide by anything - that'll probably cause non-integers to creep into the calculations). Or you could use a library. Whatever.
|
# ? Feb 8, 2013 21:55 |
|
Munkeymon posted:Or you could use a library. Whatever. If accuracy is really important, you probably should. "Use a library" is
|
# ? Feb 8, 2013 23:31 |
|
Munkeymon posted:It's because using integers to represent hundredths of a cent eliminates floating point representation problems (at reasonable scales) while retaining a good bit of precision (as long as you're careful not to divide by anything e: Point is, don't rely on a library or a scaling factor to magically save you from lossy calculations if you can avoid them in the first place. Gazpacho fucked around with this message at 03:03 on Feb 9, 2013 |
# ? Feb 9, 2013 00:04 |
|
Wheany posted:If accuracy is really important, you probably should. "Use a library" is What library?, I have seen a Bignumber library for javascript, so I could use numbers like 9999999999.99999999999999999999 If I need to. Are people suggesting this option?
|
# ? Feb 9, 2013 03:21 |
|
Tei posted:What library?, I have seen a Bignumber library for javascript, so I could use numbers like 9999999999.99999999999999999999 If I need to. Are people suggesting this option? Well, is accuracy important? Do you have a huge number of values to calculate? (a dozen items costing $7.99 each with a 5% discount, 13% VAT and a $5 coupon isn't going to be a problem) Does the Javascript code have a final say in what the value is going to be, or is it just used for a preview e.g. refreshing the number of items in a showpping cart? Is real money involved?
|
# ? Feb 9, 2013 09:38 |
|
I have a program in mind. But I asked this because I know what is the opinion of people, or to know if theres a better way to do it. There must be a better way!. Wheany posted:Well, is accuracy important? Well.. yes.. is money. People don't like wen money is lost. quote:Do you have a huge number of values to calculate? (a dozen items costing $7.99 each with a 5% discount, 13% VAT and a $5 coupon isn't going to be a problem) Not a big number of units, but many calculations: discounts, vat, coupons and other weird stuff. quote:Does the Javascript code have a final say in what the value is going to be, or is it just used for a preview e.g. refreshing the number of items in a showpping cart? Has the final say. Lets say... a POS Terminal.
|
# ? Feb 9, 2013 22:14 |
|
|
# ? Jun 1, 2024 05:53 |
|
Tei posted:Has the final say. Lets say... a POS Terminal. Classic Green or Amiga Amber?
|
# ? Feb 9, 2013 22:25 |