Vector And Magnitude - Two Points P1(30, 20) And P2(30, 221) And The Parametric Equation

Nov 22, 2011

I can't figure out this math problem. I have two points p1(30, 20) and p2(30, 221) and the parametric equation of the vector is (x-30)/(30-30)=(y-20)/(20-221)=t x=30, y=20-201*t

I'm thinking t is the magnitude or the distance. For a point P which is 10 pixels away from p1 on the vector, x=30, y=20-201*-10 (should be around -0.85) which is not the right P i'm looking for. Where am i doing wrong?

Vector Data Type (2nd Attempt)

Sep 13, 2006

A while ago I wrote a "Vector data type" script
using DOM interface to select.options.
That was a (beautiful) mind game :-) rather than
a practical thing to use.

Here is another attempt open for criticism, this
time dead serious. I really need an effective
Vector emulator for a project (as much effective
as something not implemeted in language but
emulated by means of the language itself is: a
productivity impact is imminent, the question
is to minimize it).

<html>
<title>Vector constructor</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script>
function Vector(arr) {
this.\$_\$ = arr || new Array();
this.length = this.\$_\$.length;
this.remove = Vector.\$remove;
this.toString = Vector.\$toString;
}

Vector.\$add = function(m,i) {
if (('number'!=typeof(i))||(i<0)||(i>=this.\$_\$.length)) {
this.\$_\$.push(m);
}
else {
var tmp = [m];
tmp.push(this.\$_\$[i]);
this.\$_\$.splice(i,1,tmp);
}
this.length = this.\$_\$.length;
}

Vector.\$remove = function(i) {
var ret = this.\$_\$.splice(i,1);
this.length = this.\$_\$.length;
return ret;
}

Vector.\$toString = function() {
return this.\$_\$.toString();
}

// Create new vector and use it as a wrapper
// over Array argument:
var v = new Vector([1,2,3]);

// add(newElement, atPosition) method
// if no atPosition provided, newElement will
// be added to the top
v.add(4); // add 4 to the top

// Add 3.5 atPosition 3
// The element currently located at v and all elements atop
// of it will be moved one position up

// remove(atPosition) method
// Elements currently located atop of it will be moved
// one position down
v.remove(1);

// toString method is overloaded so in string
// context it gives comma-separated vector values
alert(v); //1, 3, 3.5, 4
</script>

<body>

</body>
</html>

JQuery :: Search In A Vector Variable ?

Jun 20, 2011

I have a variable that I use for an autocomplete field. I want to search the related vvalue by ID , how can i do ?

This is the code :

What I wan't to do is get the "vvvalue" value searching using ID ex :

Gpx Vector Layer Not Displayed On Server

Oct 6, 2011

I have problem rendering vector layer on map only when is viewed from server. Local all is fine.

I'm using openlayers in combination with gpx file and txt for poi loations around route.

Look my code.

Here is link on webpage: [url]

Here is link on function: [url]

So. there should be red vector line reprizenting route from gpx file, but it is not. That is problem. when viewing localy on my pc, everithing is fine and working.

Avoid A Circular Equation In Js?

Oct 22, 2010

Im working on a project for my website where I would like to be able to change the value of a number by using js, and using getElemenById. For example:

"The taxi fare is \$25"
"A hamburger is \$4"

In the above sentence I would like to be able to change the value of 25 & 4 by giving them an id and then using js to increase (or decrease) their value, to allow for future inflation, without having to go back and manually change every number on lots of pages (if for example in 1 years time a hamburger is worth \$6 then the info above is outdated and should be changed). If i could use a variable such as "RateUSD = 1" I could increase "1" to say "1.05" and it would increase the value of all id='USD' by 5% onload rather than having to manually change it by typing.

I so far have come up with the code below, but I think the reason it does not work is because I have created a circular equation - id='USD" is the start of the equation, but it is also in the equation itself, and it is the resulting answer, so effectively I have created "A = A*B", or in this case "25 = 25*1.1"

I chose "id" as I would like to be able to have different currencies (with different id, such as 'EURO','GBP', etc) on the same pages and on multiple pages. I'll crack it eventually, I would just like to know if I'm heading in the right direction, or is there a better method that I could use? I found plenty of example for changing text with "innerHTML", but so far I haven't seen any for updating numbers onload by calculation, except for forms, etc, which are different.

The code:

<html>
<script type="text/javascript">
function changeCurrency(){

[Code].....

I will later put the js in an external file with a link to it "...src="support-files/currencyChange.js" (or something like that), but for now I have put it on the same page.

Using Outputted Data From One Site In A Equation

Dec 10, 2010

I am looking to use the outputted data of the US Census' world population clock as the raw data for a javascript function on another site - does anyone know if it is possible, looking at their site?

[url]

Or there's an rss feed of it here (xml) here:

feed:// [url]

Math Equation Getting Values From Form Fields?

Dec 8, 2010

I am having some trouble trying to fix my math equation to calculate the total rent by aquiring values from my form fields. Converting the date fields to days and finding the number of days via two date fields is mainly where I am having trouble. Also, I am trying to have a window pop up before submission but the onclick event does not seem to function properly.Below is the math equation I have come up with:

//calculate days from date field
function calcTotal(date1, date2) {
//assign variables

[code]....

Incorporate Equation Into If Statement But Cannot Get It To Calculate Properly

Jun 2, 2009

I am new to using Javascript and have been trying to incorporate this equation into my if statement but cannot get it to calculate properly no matter which method I use. Here is the function as I have it worked out presently.

[Code]...

Input That Points To Some Other Function?

Aug 16, 2009

Is it possible to have an input that points to some other function?
For example:
function someFunction() {
}function doAnotherFunction(doIt, otherFunction) {
if (doIt == true) {
otherFunction();
}}
<input type="button" value="test" onClick="doAnotherFunction(true, someFunction());">
Or would I need a switch statement and have all the various functions hardcoded?

Calculating Possible Routes Between Two Points

Oct 18, 2011

I am not a developer so not so familiar with javascript. Suppose I have a map with ten junctions and based on that map. I need to calculate all the possible routes between one junction to another. How do I represent the map in javascript and how do I code the function to calculate all the possible routes?

Calculate Possible Routes Between Two Points?

Oct 18, 2011

Suppose I have a map with ten junctions and based on that map, I need to calculate all the possible routes between one junction to another. How do I represent the map in javascript and how do I code the function to calculate all the possible routes?

Google Maps + 5000 Points Too Much For JS?

Dec 22, 2009

I have a boss who wants to show 5000 points on a Google map. So far, only a fraction of this being displayed freezes the browser. I've been challenged to make this possible while still in the realm of the browser. Would the flash version of Google maps api be a better bet? Does flash provide a better framework for this kind of heavy usage?

Round Number (Value) To 2 Decimal Points

Dec 6, 2010

I have this js function:
<script type="text/javascript">
document.PaymentForm.newbalance.value = (document.PaymentForm.balance.value -0) - (document.PaymentForm.paymentamount.value -0);
}
</script>
I want to round the value of document.PaymentForm.newbalance.value to two decimal points.

Move Start And End Points Of A Range?

Jul 1, 2011

I am trying to wrap a text selection with BBCode. I have it working, but there is one final part I need help with.[code]...

So, the last thing I need to do (the whole point of this post)... how do I MOVE the range start and end points so that only the selection is selected and NOT the whole thing?

Money Validation - Allow 2 Decimal Points 000,000.00

Oct 14, 2010

I have an input in the form, where i have to do the following validations.

1) see if it is a number

2) allow digit grouping wither like 00,00,000(Asia format) or 000,000,000 (us format)

3) allow 2 decimal points 000,000.00

4) if the money does not conform to this format return false

Get Actual Screen Size In Points Or Cm?

Nov 13, 2010

I need to know how to get the actual screen size in points or cms, not in pixels. The javascript functions give me the pixels, but I need to know how many points or centimeters that is regardless if it comes from a browser or a device like an ipad or iphone. Does anyone know the code to calculate this?

Rounding Figure And Have Only 3 Digits After Decimal Points

Nov 8, 2009

Suppose I do (5 * 0.039) + 0.59, then the result is 0.7849999999999999 - but I want to round it upwards and should have only 3 digits after decimal point. I found out that using toFixed(3) will get it to be 0.785, but the problem is that it add x.x00 for some numbers where there aren't much decimal numbers. Is there a way I can remove the 0's?

JQuery :: Bullet Points Not Working Inside Tabs?

Aug 5, 2009

I'm working on IE7. I've create two bullet point items (fred and john) inside a jquery tab but neither are appearing as bullet points. Here is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

[Code]......

Estimate To Viewers Based On Their Input - Decimal Points

Jan 22, 2010

I am trying to develop a form that can give an estimate to viewers based on their input and I'm having a problem with decimal points. I couldn't find a very good free script online so I've done some work with this one [URL] When you enter 10 in the input box, it calculate 10*19.99, giving 199.9, but I want it to show 199.90. I've tried adding toFixed(2) in there, but I'm not able to get that to work.

Split On Decimal Code Points Or Equivalent Format?

May 10, 2010

I am in the process of using the split function for splitting strings into an array. The problem I am dealing with is how to do this with local language. Not all languages us the space " " delimiter between words to write a phrase or sentence.

I have a list of all of delimiters for english, japanese, chinese, korean in Decimal Code Point format. For example, the decimal code point equivalent for " " is 32. Is it possible to use the javascript split function with decimal code points? If not, how can I reformat them into a format that js would understand?

Google Maps API V3 - Custom Points Not Plotting In Chrome Only?

Mar 9, 2011

[URL] If you go to this site in Chrome (or Safari) I get a Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1 javascript error and my markers do not show up. In all other non-webket browsers I do not see this problem.

Make Decimal Points An Exception To Non-number Pattern?

Sep 9, 2010

Tell me how to make decimal points an exception to the non-number pattern?code...

Update Power Points Field If Select Option Is Chosen

Sep 5, 2009

I want to know how I can update my power_points field if a select option is chosen.

Geographical - Get The Distance Between Any Two Points Of Latitude And Longitude On The Earth's Surface

Sep 20, 2010

I've found the Harvesine forumla to get the distance between any two points of latitude and longitude on the earth's surface. What I want is a little different - I want that, given a point and a distance, to get the latitude and longitude of a second point. I'm having trouble reversing the forumla. The current formula:

[Code]...

Paintshop Functionality - Rectangle Boundarys And Then Rectangle Should Be Rotated & Stretched Via Those Points & Moved Via Nineth Center Point

Aug 27, 2011

In PS you press CTRL+T on new layer. 9 handles appears an then you can stretch/rotate/move that layer. Looking just for that stretch & rotate functionality with dotted/dashed retangle outline. That is, there should be 8 handles on rectangle boundarys and then rectangle should be rotated & stretched via those points. & moved via nineth center point.