Could not access memory, Segmentation Fault - stl

I am trying to implement a Sierpinski Gasket using an iterative algorithm emulating the recursive version.
I am getting a segmentation fault. Probably the function is trying to dereference a NULL pointer, but I can't find it. The problem should be in the if block not in else. Because it is working fine if it skips the if block. Thanks for your help.
GLfloat points[18*(3^GENCOUNT)];
std::stack<Pyramid *> Q;
// initial Pyramid
Q.push(new Pyramid(Vec3(0.0f, 0.4f, 0.0f),
Vec3(-0.4f, -0.4f, 0.4f),
Vec3(0.4f, -0.4f, 0.4f),
Vec3(0.4f, -0.4f, -0.4f),
Vec3(-0.4f, -0.4f, -0.4f), 0));
int i = 0;
while(!Q.empty())
{
Pyramid *topPyr = Q.top();
Q.pop();
if(topPyr->mGeneration < GENCOUNT)
{
Vec3 baseVec3 = (((topPyr->mV2+topPyr->mV3)/2.0f) + ((topPyr->mV4+topPyr->mV5)/2.0f)) / 2.0f;
Q.push(new Pyramid(topPyr->mV1,
(topPyr->mV1+topPyr->mV2)/2.0f,
(topPyr->mV1+topPyr->mV3)/2.0f,
(topPyr->mV1+topPyr->mV4)/2.0f,
(topPyr->mV1+topPyr->mV5)/2.0f, topPyr->mGeneration+1));
Q.push(new Pyramid((topPyr->mV1+topPyr->mV2)/2.0f,
topPyr->mV2,
(topPyr->mV2+topPyr->mV3)/2.0f,
baseVec3,
(topPyr->mV2+topPyr->mV5)/2.0f, topPyr->mGeneration+1));
Q.push(new Pyramid((topPyr->mV1+topPyr->mV3)/2.0f,
(topPyr->mV2+topPyr->mV3)/2.0f,
topPyr->mV3,
(topPyr->mV3+topPyr->mV4)/2.0f,
baseVec3, topPyr->mGeneration+1));
Q.push(new Pyramid((topPyr->mV1+topPyr->mV4)/2.0f,
baseVec3,
(topPyr->mV3+topPyr->mV4)/2.0f,
topPyr->mV4,
(topPyr->mV4+topPyr->mV5)/2.0f, topPyr->mGeneration+1));
Q.push(new Pyramid((topPyr->mV1+topPyr->mV5)/2.0f,
(topPyr->mV2+topPyr->mV5)/2.0f,
baseVec3,
(topPyr->mV4+topPyr->mV5)/2.0f,
topPyr->mV5, topPyr->mGeneration+1));
}
else
{
memcpy(points+i, topPyr->mV1.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV2.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV3.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV1.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV3.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV4.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV1.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV4.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV5.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV1.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV5.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV2.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV2.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV3.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV4.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV4.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV5.mVec3, sizeof(GLfloat)*3);i+=3;
memcpy(points+i, topPyr->mV2.mVec3, sizeof(GLfloat)*3);i+=3;
}
delete topPyr;
}

My C++ is very rusty, but assuming that no operator overloading is happening, doesn't
3^GENCOUNT
in your very first line mean "the bitwise XOR between 3 and GENCOUNT"? I'm pretty sure you meant that to be exponentiation, i.e. 3 to the power of GENCOUNT.

Related

How do I output the results of this python variable under a button in html?

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CALOCATE</title>
</head>
<body>
<table>
<tbody>
<tr style="font-size:40px;">
<td style="font-family:Century Gothic; text-align:center ">CALOCATE</td>
</tr>
<tr>
<td><input type="button" name="one" value="1" onclick="calculator.display.value += '1'"></td>
<td><input type="button" name="two" value="2" onclick="calculator.display.value += '2'"></td>
<td><input type="button" name="three" value="3" onclick="calculator.display.value += '3'"></td>
<td><input type="button" class="operator" name="plus" value="+" onclick="calculator.display.value += '+'"></td>
</tr>
</tbody>
</table>
<h2 style="font-family:Century Gothic; text-align:center ">Click What You Require</h2>
<input style="font-family:Century Gothic; text-align:center "type="button" onclick="alert('cals[0]')" value="SPEED">
<input style="font-family:Century Gothic; text-align:center "type="button" onclick="alert('230.18444756937043 m/s')" value="SPEED">
<input style="font-family:Century Gothic; text-align:center "type="button" onclick="alert('burnt -296.6710526315789)" value="FCALS BURNED">
<input style="font-family:Century Gothic; text-align:center "type="button" onclick="alert(-307.97488038277515)" value="MALE CALORIES BURNED">
<input style="font-family:Century Gothic; text-align:center "type="button" onclick="alert('Your journey lasted 35 mins')" value="JOURNEY TIME">
<table width="100%" border="0">
</table>
</body>
</html>
I have some variables in python that I want to be displayed as output when I click on the`buttons above. I've been trying to figure out a way to do this but I can't figure out a way to display this output without having to create a dynamic website. Is there anyone who knows how to change this? The code I want to get the variables from will be displayed below. I want the variables 'mCals, wCals, jtime and speed' to be displayed when the buttons 'MALE CALORIES BURNED', 'FCALS BURNED', 'JOURNEY' and 'SPEED' are clicked respectively.
class LocationsWebsite(object):
#cherrypy.expose
#cherrypy.tools.gzip()
def index(self):
template = JINJA_ENVIRONMENT.get_template('index-copy.html')
template_values = {
'locations': self.get_locations(), 'calories': self.get_distance()} #template_values is a dict. key is 'locations', values is a list of lists of two items (long, lat)
return template.render(template_values) #make and serve the webpage
def get_locations(self):
locations = []
dates = self.get_dates()
times = self.get_times()
latitudes = self.get_latitudes()
longitudes = self.get_longitudes()
distance = self.get_distance()
speed = self.speed1(dist, jtime)
calories = get_calories(Age,Weight,Hr,jtime)
for i in range(len(latitudes)):
locations.append([latitudes[i],longitudes[i], dates [i], times[i]]) #make list of lists to enable jinja render as columns
return locations
def get_latitudes(self):
latitudes = []
with sql.connect(DB) as cur:
results = cur.execute('''SELECT latitude FROM Location;''')
for latitude, in results:
latitudes.append(float(latitude))
return latitudes
def get_longitudes(self):
longitudes = []
with sql.connect(DB) as cur:
results = cur.execute('''SELECT longitude FROM Location;''')
for longitude, in results:
longitudes.append(float(longitude))
return longitudes
def get_dates(self):
dates = []
with sql.connect(DB) as cur:
results = cur.execute('''SELECT date FROM Location;''')
for date, in results:
dates.append(str(date))
return dates
def get_times(self):
times = []
with sql.connect(DB) as cur:
results = cur.execute('''SELECT time FROM Location;''')
for time, in results:
times.append(time.split(":"))
return (times)
jtime = get_jtime(times)
def get_jtime(self):
times = self.get_times();
stimehr = int(times[0][0]) #this converts the first item(hours) in the first list(time) into an integer
#so that it can be added to the second item (seconds)
stimemin = int(times[0][1])
stime = (stimehr*60) + stimemin
etimehr = int(times[-1][0])
etimemin = int (times[-1][1])
etime = (etimehr*60) + etimemin
etime = int(etime)
jtime = etime - stime
# print ('Your journey lasted', jtime, 'mins')
return jtime
def speed1 (self, dist, jtime):
speed = dist / jtime
return (speed, "m/s")
def get_distance(self):
latitudes = self.get_latitudes()
longitudes = self.get_longitudes()
slat = radians(latitudes[0])
elat = radians( (latitudes[-1]))
slon = radians( (longitudes[0]))
elon = radians( (longitudes[-1]))
dist = float(6371.01 * (acos(sin(slat) * sin(elat)) + cos(slat)*cos(elat) * cos(slon - elon)))
jtime = self.get_jtime()
speed = self.speed1(dist, jtime)
mCals = ((Age * 0.201)-(mweight * 0.09)+(jtime * 0.63)-(55.09))*(jtime/4.18)
wCals = ((Age * 0.201)-(fweight * 0.09)+(jtime * 0.63)-(55.09))*(jtime/4.18)
#print("If you are a female you have burnt",(wCals)," calories")
#print("If you are a male you have burnt",(mCals)," calories")
mCals = str(mCals)
wCals = str(wCals)
jtime = str(jtime)
speed = str(speed)
cals = [jtime,speed,mCals,wCals]
return (cals)
You could use something like Pip - Python in PHP and simply copy the python script to your newly created php page.
I don't believe you can do what you want purely in HTML + Python, you'll likely need a server-side language to bridge the two, such as PHP.
You can also just call a python file directly from PHP using exec .
As a third alternative, you could also store the data in a .txt file which both python and php/html can read and write to natively
EDIT:
create an empty .txt file in the same directory as your scripts.
Python to .txt :
file = open("demofile.txt", "w")
file.write("now im writing a line in this file with and saving a variable ", var1)
From .txt to PHP:
<?php
$myfile = fopen("demofile.txt", "r") or die("No file found!");
echo fread($myfile);
fclose($myfile);
?>
Untested, but should work.

how to insert these data into mysql in wampserver

here are is the code.no matter what i did couldnt connect to mysql database in phpadmin in the wampserver all attempts has failed please help to solve
if (isset($_POST['continue'])) {
$j=0;
while ($j < $passengers)
{
$register_data2 = array(
'first_name' => $_POST["fname"][$j],
'last_name' => $_POST["lname"][$j],
'passport' => $_POST["passport"][$j],
'visa' => $_POST["visa"][$j],
'address1' => $_POST["address1"][$j],
'address2' => $_POST["address2"][$j],
'email' => $_POST["email"][$j],
'contact' => $_POST["contact"][$j],
'pin' => $_POST["pin"][$j],
'leaving_from' => $pieces[0],
'going_to' => $pieces[2],
'depart_date' => $pieces[7],
'depart_time' => $pieces[12],
'arrival_time' => $pieces[17],
'grand_fare' => $pieces[22],
'returning_from' => $pieces1[0],
'returning_to' => $pieces1[2],
'returning_date' => $pieces1[7],
'returning_time' => $pieces1[11],
'reaching_time' => $pieces1[16],
'fare' => $pieces1[21]
);
session_start();
$_SESSION['ticket'][] = $_POST["fname"][$j];
$_SESSION['ticket'][] = $_POST["lname"][$j];
$_SESSION['ticket'][] = $_POST["passport"][$j];
$_SESSION['ticket'][] = $_POST["visa"][$j];
$_SESSION['ticket'][] = $_POST["pin"][$j];
register_passenger($register_data2);
$j = $j+1;
}
$_SESSION['ticket1'] = $pieces[0];
$_SESSION['ticket2'] = $pieces[2];
$_SESSION['ticket3'] = $pieces[7];
$_SESSION['ticket4'] = $pieces[12];
$_SESSION['ticket5'] = $pieces[17];
$_SESSION['ticket6'] = $pieces[22];
$_SESSION['ticket11'] = $pieces1[0];
$_SESSION['ticket22'] = $pieces1[2];
$_SESSION['ticket33'] = $pieces1[7];
$_SESSION['ticket44'] = $pieces1[11];
$_SESSION['ticket55'] = $pieces1[16];
$_SESSION['ticket66'] = $pieces1[21];
}
?>
<?php
if (isset($_POST['pay'])){
if ($_POST['cash'] != $grand_total) {
echo "*Pay the given amount!"."<br>";
}
else{
header ('Location: ticket.php');
}
}
?>
<h2> Select payment method </h2>
<form action="payment.php" method="post">
<input type="radio" name="payment" id="cash" checked="checked" value="cash">
<label for="cash">Cash</label>
<input type="number" id="cash" name="cash" size="8"><br><br>
<input type="radio" name="payment" id="card" value="card">
<label for="card">Card</label>
<select>
<option>Debit card</option>
<option>Credit card</option>
</select>
<br>
<img src="Credit.jpg">
<br>
<input type="submit" name="pay" value="Make payment">
</form>
<?php
if(isset($_POST["Continue"])){
$firstname = $_POST['fname'];
$lastname = $_POST['lname'];
$passport = $_POST['passport'];
$visa = $_POST['visa'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$pin = $_POST['pin'];
mysql_query( "INSERT INTO passengers (first_name,last_name,passport,visa,address1,address2,email,contact,pin) VALUES('$lastname','$passport','passport','$visa','$address1','$address2','$email','$contact','$pin')");
}
?>
i couldnt connect the data to mysql database in the phpadmin in the wampserver. it shows up nothing. as you can see below one of my many attempt to correct to make it work it up as fail. non of the method that i tried didnt work. please help to sove this problem
It seems you messed up the values list:
mysql_query( "INSERT INTO passengers
(first_name,last_name,passport,visa,address1,address2,email,contact,pin)
VALUES
('$lastname','$passport','passport','$visa','$address1','$address2','$email','$contact','$pin')");
First name is missing, 'passport' should not be there, etc. It should be:
('$firstname','$lastname','$passport','$visa','$address1','$address2','$email','$contact','$pin')");

Google API set Multi Dimensional Polygon

I am trying to set Multiple Polygons to a Google map from an array. The array is passed into the view from the Control via a database WKT value as you can see in the example. Everything works except getting it to create individual polygons.
The issue I am running into is that I cannot seem to get it to draw individual Polygons. It draws one, then moves on the next but does not break and start a new one. The number of points and number of Polygons will vary almost every time the page is loaded, they are not static Polygons.
<script type="text/javascript">
var newArr = [];
var FinishedPoly = [];
var doubleLayer = [];
var Completed = [];
var i = 0;
var PolygonOut = { "type": "Polygon", "coordinates": [[[-90.968107709266562, 38.099441706209241], [-90.967945223634572, 38.099447106988919], [-90.967783246532832, 38.099458604972995], [-90.967622144142851, 38.099476174167982], [-90.9674622806693, 38.099499774855182], [-90.967304017516966, 38.099529353680481], [-90.96714771247396, 38.099564843774878], [-90.966993718903126, 38.099606164905637], [-90.966842384943376, 38.099653223657619], [-90.966694052722886, 38.099705913644364], [-90.966549057585866, 38.09976411574857], [-90.966407727334541, 38.099827698391294], [-90.966270381488286, 38.099896517829265], [-90.966137330561338, 38.099970418479884], [-90.96600887536097, 38.100049233272728], [-90.965885306307413, 38.100132784027231], [-90.965766902777432, 38.100220881855364], [-90.965653932472634, 38.100313327588573], [-90.965546650814275, 38.10040991222796], [-90.965445300365758, 38.100510417416608], [-90.965350110284135, 38.100614615933246], [-90.965261295801952, 38.100722272205715], [-90.965179057740443, 38.100833142843541], [-90.9651035820554, 38.100946977188066], [-90.96503503941652, 38.101063517879027], [-90.964973584821365, 38.101182501436348], [-90.964919357244582, 38.101303658855713], [-90.964872479323546, 38.101426716216707], [-90.96483305708071, 38.101551395302018], [-90.964801179683647, 38.101677414226373], [-90.964776919243064, 38.10180448807386], [-90.964760330649483, 38.101932329541988], [-90.964751451448748, 38.102060649591252], [-90.956501934838812, 38.310868546056618], [-90.95650085334276, 38.311001194985508], [-90.956508034151412, 38.311133725939143], [-90.956523460010317, 38.311265819630947], [-90.956547093801035, 38.311397157826029], [-90.956578878630054, 38.311527424107915], [-90.9566187379655, 38.311656304640842], [-90.956666575821032, 38.311783488925961], [-90.9567222769867, 38.311908670549414], [-90.956785707306253, 38.312031547920576], [-90.956856713999841, 38.312151824998814], [-90.956935126031908, 38.312269212006761], [-90.95702075452283, 38.312383426128591], [-90.957113393203812, 38.312494192191437], [-90.957212818913547, 38.312601243328544], [-90.9573187921357, 38.312704321622306], [-90.957431057575775, 38.312803178725758], [-90.9575493447761, 38.312897576461154], [-90.957673368767288, 38.3129872873938], [-90.957802830754858, 38.313072095380242], [-90.957937418839009, 38.313151796089087], [-90.958076808766137, 38.313226197493506], [-90.958220664710211, 38.313295120333969], [-90.958368640081815, 38.313358398550264], [-90.9585203783635, 38.313415879681735], [-90.958675513968856, 38.313467425234684], [-90.958833673123465, 38.313512911016204], [-90.9589944747658, 38.313552227433455], [-90.959157531465507, 38.313585279757838], [-90.959322450357149, 38.313611988353237], [-90.959488834087068, 38.313632288868057], [-90.959656281771061, 38.313646132390247], [-90.959824389960588, 38.313653485565204], [-90.95999275361514, 38.313654330676158], [-90.960160967078508, 38.313648665686905], [-90.96032862505642, 38.313636504246695], [-90.96049532359352, 38.3136178756573], [-90.960660661046816, 38.313592824802456], [-90.960824239053878, 38.313561412039647], [-90.960985663492792, 38.313523713054643], [-90.9611445454322, 38.313479818679042], [-90.961300502068511, 38.313429834671439], [-90.961453157648549, 38.313373881462446], [-90.961602144375092, 38.313312093864489], [-90.961747103293234, 38.313244620746879], [-90.961887685155361, 38.313171624677032], [-90.962023551262817, 38.313093281528666], [-90.962154374281965, 38.313009780057953], [-90.962279839032988, 38.3129213214486], [-90.962399643249213, 38.312828118826992], [-90.962513498305455, 38.312730396748634], [-90.962621129913259, 38.312628390656926], [-90.962722278781726, 38.312522346315795], [-90.9628167012421, 38.312412519217482], [-90.962904169834644, 38.312299173966849], [-90.962984473856466, 38.31218258364369], [-90.96305741986896, 38.312063029144809], [-90.963122832163577, 38.311940798507052], [-90.963180553184813, 38.311816186213306], [-90.963230443909538, 38.311689492482934], [-90.96327238418155, 38.311561022548375], [-90.96330627300074, 38.311431085919686], [-90.963332028765933, 38.311299995638855], [-90.963349589471193, 38.311168067525557], [-90.963358912854687, 38.311035619416181], [-90.971588888328952, 38.102227246362872], [-90.971589839404146, 38.102090447347592], [-90.971582029203063, 38.10195378554414], [-90.971565477784637, 38.101817611082176], [-90.971540227602333, 38.101682272840854], [-90.9715063433949, 38.101548117555019], [-90.971463912020027, 38.1014154889269], [-90.971413042231362, 38.101284726745618], [-90.97135386439939, 38.101156166016786], [-90.971286530177068, 38.101030136104235], [-90.971211212110859, 38.100906959886352], [-90.971128103198311, 38.100786952928992], [-90.971037416393344, 38.100670422677155], [-90.970939384060244, 38.100557667667452], [-90.970834257378286, 38.1004489767634], [-90.97072230569789, 38.100344628415613], [-90.970603815850453, 38.100244889948478], [-90.970479091413424, 38.100150016875546], [-90.970348451932466, 38.100060252245065], [-90.970212232102782, 38.09997582601747], [-90.970070780911712, 38.099896954476463], [-90.9699244607447, 38.09982383967499], [-90.969773646457114, 38.099756668917827], [-90.969618724413948, 38.0996956142819], [-90.969460091500267, 38.099640832175496], [-90.969298154104678, 38.099592462937821], [-90.969133327078524, 38.099550630479456], [-90.968966032673322, 38.099515441965139], [-90.968796699459418, 38.099486987539258], [-90.968625761228381, 38.099465340095023], [-90.9684536558821, 38.099450555087778], [-90.968280824311307, 38.099442670392982], [-90.968107709266562, 38.099441706209241]], [[-90.678323452631432, 37.999953737944836], [-90.678166455726412, 37.999959594774936], [-90.678009965494056, 37.99997116027825], [-90.677854313259544, 37.999988409968019], [-90.6776998285744, 38.00001130732273], [-90.677546838518992, 38.000039803863437], [-90.677395667010231, 38.000073839256387], [-90.677246634116017, 38.000113341440695], [-90.677100055377679, 38.0001582267809], [-90.676956241142179, 38.000208400243935], [-90.67681549590516, 38.0002637556003], [-90.676678117666356, 38.000324175648927], [-90.676544397298827, 38.000389532465249], [-90.676414617933233, 38.0004596876719], [-90.676289054358378, 38.00053449273171], [-90.676167972439544, 38.00061378926209], [-90.67605162855557, 38.000697409370211], [-90.675940269056085, 38.000785176008463], [-90.67583412973984, 38.00087690334923], [-90.675733435355482, 38.000972397178209], [-90.675638399125617, 38.001071455305521], [-90.675549222295217, 38.001173867993757], [-90.675466093705438, 38.001279418401992], [-90.6753891893937, 38.001387883044721], [-90.675318672220655, 38.00149903226508], [-90.6752546915254, 38.001612630720977], [-90.6751973828088, 38.001728437883315], [-90.675146867446614, 38.001846208545231], [-90.675103252432081, 38.001965693341241], [-90.675066630149217, 38.002086639275127], [-90.675037078176885, 38.002208790255658], [-90.6750146591243, 38.002331887638761], [-90.674999420498054, 38.002455670775106], [-90.639276413897491, 38.378067481029881], [-90.639267996619338, 38.378199965586916], [-90.6392678479397, 38.378332615670367], [-90.639275968262183, 38.378465111708238], [-90.639292338069083, 38.3785971344979], [-90.6393169179679, 38.378728365975149], [-90.639349648785839, 38.378858489980431], [-90.639390451711947, 38.378987193020642], [-90.63943922848658, 38.379114165024362], [-90.6394958616377, 38.379239100089016], [-90.639560214763549, 38.37936169721786], [-90.639632132860925, 38.379481661045261], [-90.639711442698285, 38.379598702548428], [-90.639797953232815, 38.379712539743771], [-90.6398914560704, 38.379822898366442], [-90.639991725967491, 38.379929512531163], [-90.6400985213736, 38.380032125373006], [-90.640211585013049, 38.380130489666328], [-90.640330644504786, 38.380224368420556], [-90.640455413018387, 38.380313535451322], [-90.640585589965255, 38.380397775925488], [-90.64072086172267, 38.380476886878952], [-90.640860902389548, 38.380550677705692], [-90.641005374571591, 38.380618970617213], [-90.641153930194392, 38.380681601070975], [-90.641306211342126, 38.380738418166963], [-90.641461851120113, 38.380789285011353], [-90.641620474538939, 38.380834079046444], [-90.6417816994182, 38.380872692346067], [-90.641945137307559, 38.38090503187567], [-90.642110394422971, 38.380931019716563], [-90.642277072595647, 38.380950593253672], [-90.642444770231819, 38.380963705326529], [-90.64261308328058, 38.380970324342883], [-90.642781606207777, 38.380970434354857], [-90.64294993297338, 38.380964035097385], [-90.643117658010141, 38.380951141988859], [-90.643284377201127, 38.380931786093967], [-90.643449688853721, 38.380906014048776], [-90.64361319466768, 38.380873887948432], [-90.643774500695244, 38.380835485197387], [-90.643933218290485, 38.380790898322914], [-90.644088965046038, 38.380740234752047], [-90.644241365714677, 38.380683616552737], [-90.644390053113625, 38.380621180139613], [-90.644534669009488, 38.380553075945166], [-90.644674864981468, 38.380479468057281], [-90.644810303261025, 38.3804005338237], [-90.644940657545717, 38.380316463424677], [-90.645065613785476, 38.380227459414577], [-90.645184870939246, 38.380133736233795], [-90.645298141700337, 38.380035519691894], [-90.6454051531885, 38.379933046423517], [-90.645505647607351, 38.379826563318048], [-90.64559938286537, 38.379716326924708], [-90.645686133158918, 38.379602602834311], [-90.645765689516153, 38.379485665039255], [-90.645837860300233, 38.379365795273316], [-90.645902471670723, 38.37924328233273], [-90.645959368002181, 38.379118421380348], [-90.646008412258709, 38.378991513234389], [-90.646049486323818, 38.378862863643654], [-90.646082491284531, 38.378732782550841], [-90.646107347669428, 38.378601583345741], [-90.646123995639556, 38.378469582110185], [-90.681812121406509, 38.002855712080027], [-90.681820663991914, 38.002714926225892], [-90.681819919332568, 38.00257397942601], [-90.681809889507221, 38.002433255001819], [-90.681790601846274, 38.002293135667749], [-90.681762108857114, 38.002154002490506], [-90.681724488080533, 38.0020162338527], [-90.681677841879477, 38.001880204423841], [-90.681622297159976, 38.001746284141554], [-90.681558005025579, 38.001614837205537], [-90.681485140366, 38.001486221087255], [-90.6814039013809, 38.001360785557871], [-90.681314509040632, 38.001238871737193], [-90.681217206484831, 38.001120811166146], [-90.681112258360969, 38.00100692490529], [-90.68099995010428, 38.000897522661859], [-90.680880587161411, 38.000792901947776], [-90.680754494159544, 38.000693347270605], [-90.68062201402347, 38.000599129360154], [-90.680483507043007, 38.000510504432384], [-90.68033934989316, 38.00042771349279], [-90.680189934609885, 38.000350981681244], [-90.68003566752401, 38.00028051765986], [-90.679876968156492, 38.000216513045771], [-90.679714268077731, 38.000159141890137], [-90.679548009734148, 38.000108560205049], [-90.679378645245421, 38.000064905539347], [-90.679206635175163, 38.000028296604739], [-90.679032447278956, 37.99999883295304], [-90.678856555232727, 37.999976594705572], [-90.678679437344954, 37.999961642335386], [-90.678501575256547, 37.999954016502777], [-90.678323452631432, 37.999953737944836]]]};
var doubleLayer = PolygonOut.coordinates;
$(document).ready(function CleanIt() {
for (var s = 0; s < doubleLayer.length; s++) {
for (var i = doubleLayer[s].length; i--;) {
var temp = doubleLayer[s][i][0];
doubleLayer[s][i][0] = doubleLayer[s][i][1];
doubleLayer[s][i][1] = temp;
}
for (var t = 0; t < doubleLayer[s].length; t++)
{
var Coords = [];
newArr = newArr.concat(doubleLayer[s][t]);
FinishedPoly[s] = newArr;
for (var p = 0; p < FinishedPoly.length; p++)
{
for (var j = 0, g = 0; j < FinishedPoly[p].length; j++, g++)
{
Coords = new google.maps.LatLng(FinishedPoly[p][j], FinishedPoly[p][j + 1]);
j++;
Completed[g] = Coords;
}
}
}
var compPoly = new google.maps.Polygon({
paths: Completed,
strokeColor: '#e88e19',
strokeOpacity: 0.7,
strokeWeight: 2,
fillColor: '#247fb8',
fillOpacity: 0.35
});
compPoly.setMap(map);
}
});
</script>
SOLVED
<script type="text/javascript">
var newArr = [];
var FinishedPoly = [];
var doubleLayer = [];
var Completed = [];
var Coords = [];
var i = 0;
var PolygonOut = { "type": "Polygon", "coordinates": [[[-90.968107709266562, 38.099441706209241], [-90.967945223634572, 38.099447106988919], [-90.967783246532832, 38.099458604972995], [-90.967622144142851, 38.099476174167982], [-90.9674622806693, 38.099499774855182], [-90.967304017516966, 38.099529353680481], [-90.96714771247396, 38.099564843774878], [-90.966993718903126, 38.099606164905637], [-90.966842384943376, 38.099653223657619], [-90.966694052722886, 38.099705913644364], [-90.966549057585866, 38.09976411574857], [-90.966407727334541, 38.099827698391294], [-90.966270381488286, 38.099896517829265], [-90.966137330561338, 38.099970418479884], [-90.96600887536097, 38.100049233272728], [-90.965885306307413, 38.100132784027231], [-90.965766902777432, 38.100220881855364], [-90.965653932472634, 38.100313327588573], [-90.965546650814275, 38.10040991222796], [-90.965445300365758, 38.100510417416608], [-90.965350110284135, 38.100614615933246], [-90.965261295801952, 38.100722272205715], [-90.965179057740443, 38.100833142843541], [-90.9651035820554, 38.100946977188066], [-90.96503503941652, 38.101063517879027], [-90.964973584821365, 38.101182501436348], [-90.964919357244582, 38.101303658855713], [-90.964872479323546, 38.101426716216707], [-90.96483305708071, 38.101551395302018], [-90.964801179683647, 38.101677414226373], [-90.964776919243064, 38.10180448807386], [-90.964760330649483, 38.101932329541988], [-90.964751451448748, 38.102060649591252], [-90.956501934838812, 38.310868546056618], [-90.95650085334276, 38.311001194985508], [-90.956508034151412, 38.311133725939143], [-90.956523460010317, 38.311265819630947], [-90.956547093801035, 38.311397157826029], [-90.956578878630054, 38.311527424107915], [-90.9566187379655, 38.311656304640842], [-90.956666575821032, 38.311783488925961], [-90.9567222769867, 38.311908670549414], [-90.956785707306253, 38.312031547920576], [-90.956856713999841, 38.312151824998814], [-90.956935126031908, 38.312269212006761], [-90.95702075452283, 38.312383426128591], [-90.957113393203812, 38.312494192191437], [-90.957212818913547, 38.312601243328544], [-90.9573187921357, 38.312704321622306], [-90.957431057575775, 38.312803178725758], [-90.9575493447761, 38.312897576461154], [-90.957673368767288, 38.3129872873938], [-90.957802830754858, 38.313072095380242], [-90.957937418839009, 38.313151796089087], [-90.958076808766137, 38.313226197493506], [-90.958220664710211, 38.313295120333969], [-90.958368640081815, 38.313358398550264], [-90.9585203783635, 38.313415879681735], [-90.958675513968856, 38.313467425234684], [-90.958833673123465, 38.313512911016204], [-90.9589944747658, 38.313552227433455], [-90.959157531465507, 38.313585279757838], [-90.959322450357149, 38.313611988353237], [-90.959488834087068, 38.313632288868057], [-90.959656281771061, 38.313646132390247], [-90.959824389960588, 38.313653485565204], [-90.95999275361514, 38.313654330676158], [-90.960160967078508, 38.313648665686905], [-90.96032862505642, 38.313636504246695], [-90.96049532359352, 38.3136178756573], [-90.960660661046816, 38.313592824802456], [-90.960824239053878, 38.313561412039647], [-90.960985663492792, 38.313523713054643], [-90.9611445454322, 38.313479818679042], [-90.961300502068511, 38.313429834671439], [-90.961453157648549, 38.313373881462446], [-90.961602144375092, 38.313312093864489], [-90.961747103293234, 38.313244620746879], [-90.961887685155361, 38.313171624677032], [-90.962023551262817, 38.313093281528666], [-90.962154374281965, 38.313009780057953], [-90.962279839032988, 38.3129213214486], [-90.962399643249213, 38.312828118826992], [-90.962513498305455, 38.312730396748634], [-90.962621129913259, 38.312628390656926], [-90.962722278781726, 38.312522346315795], [-90.9628167012421, 38.312412519217482], [-90.962904169834644, 38.312299173966849], [-90.962984473856466, 38.31218258364369], [-90.96305741986896, 38.312063029144809], [-90.963122832163577, 38.311940798507052], [-90.963180553184813, 38.311816186213306], [-90.963230443909538, 38.311689492482934], [-90.96327238418155, 38.311561022548375], [-90.96330627300074, 38.311431085919686], [-90.963332028765933, 38.311299995638855], [-90.963349589471193, 38.311168067525557], [-90.963358912854687, 38.311035619416181], [-90.971588888328952, 38.102227246362872], [-90.971589839404146, 38.102090447347592], [-90.971582029203063, 38.10195378554414], [-90.971565477784637, 38.101817611082176], [-90.971540227602333, 38.101682272840854], [-90.9715063433949, 38.101548117555019], [-90.971463912020027, 38.1014154889269], [-90.971413042231362, 38.101284726745618], [-90.97135386439939, 38.101156166016786], [-90.971286530177068, 38.101030136104235], [-90.971211212110859, 38.100906959886352], [-90.971128103198311, 38.100786952928992], [-90.971037416393344, 38.100670422677155], [-90.970939384060244, 38.100557667667452], [-90.970834257378286, 38.1004489767634], [-90.97072230569789, 38.100344628415613], [-90.970603815850453, 38.100244889948478], [-90.970479091413424, 38.100150016875546], [-90.970348451932466, 38.100060252245065], [-90.970212232102782, 38.09997582601747], [-90.970070780911712, 38.099896954476463], [-90.9699244607447, 38.09982383967499], [-90.969773646457114, 38.099756668917827], [-90.969618724413948, 38.0996956142819], [-90.969460091500267, 38.099640832175496], [-90.969298154104678, 38.099592462937821], [-90.969133327078524, 38.099550630479456], [-90.968966032673322, 38.099515441965139], [-90.968796699459418, 38.099486987539258], [-90.968625761228381, 38.099465340095023], [-90.9684536558821, 38.099450555087778], [-90.968280824311307, 38.099442670392982], [-90.968107709266562, 38.099441706209241]], [[-90.678323452631432, 37.999953737944836], [-90.678166455726412, 37.999959594774936], [-90.678009965494056, 37.99997116027825], [-90.677854313259544, 37.999988409968019], [-90.6776998285744, 38.00001130732273], [-90.677546838518992, 38.000039803863437], [-90.677395667010231, 38.000073839256387], [-90.677246634116017, 38.000113341440695], [-90.677100055377679, 38.0001582267809], [-90.676956241142179, 38.000208400243935], [-90.67681549590516, 38.0002637556003], [-90.676678117666356, 38.000324175648927], [-90.676544397298827, 38.000389532465249], [-90.676414617933233, 38.0004596876719], [-90.676289054358378, 38.00053449273171], [-90.676167972439544, 38.00061378926209], [-90.67605162855557, 38.000697409370211], [-90.675940269056085, 38.000785176008463], [-90.67583412973984, 38.00087690334923], [-90.675733435355482, 38.000972397178209], [-90.675638399125617, 38.001071455305521], [-90.675549222295217, 38.001173867993757], [-90.675466093705438, 38.001279418401992], [-90.6753891893937, 38.001387883044721], [-90.675318672220655, 38.00149903226508], [-90.6752546915254, 38.001612630720977], [-90.6751973828088, 38.001728437883315], [-90.675146867446614, 38.001846208545231], [-90.675103252432081, 38.001965693341241], [-90.675066630149217, 38.002086639275127], [-90.675037078176885, 38.002208790255658], [-90.6750146591243, 38.002331887638761], [-90.674999420498054, 38.002455670775106], [-90.639276413897491, 38.378067481029881], [-90.639267996619338, 38.378199965586916], [-90.6392678479397, 38.378332615670367], [-90.639275968262183, 38.378465111708238], [-90.639292338069083, 38.3785971344979], [-90.6393169179679, 38.378728365975149], [-90.639349648785839, 38.378858489980431], [-90.639390451711947, 38.378987193020642], [-90.63943922848658, 38.379114165024362], [-90.6394958616377, 38.379239100089016], [-90.639560214763549, 38.37936169721786], [-90.639632132860925, 38.379481661045261], [-90.639711442698285, 38.379598702548428], [-90.639797953232815, 38.379712539743771], [-90.6398914560704, 38.379822898366442], [-90.639991725967491, 38.379929512531163], [-90.6400985213736, 38.380032125373006], [-90.640211585013049, 38.380130489666328], [-90.640330644504786, 38.380224368420556], [-90.640455413018387, 38.380313535451322], [-90.640585589965255, 38.380397775925488], [-90.64072086172267, 38.380476886878952], [-90.640860902389548, 38.380550677705692], [-90.641005374571591, 38.380618970617213], [-90.641153930194392, 38.380681601070975], [-90.641306211342126, 38.380738418166963], [-90.641461851120113, 38.380789285011353], [-90.641620474538939, 38.380834079046444], [-90.6417816994182, 38.380872692346067], [-90.641945137307559, 38.38090503187567], [-90.642110394422971, 38.380931019716563], [-90.642277072595647, 38.380950593253672], [-90.642444770231819, 38.380963705326529], [-90.64261308328058, 38.380970324342883], [-90.642781606207777, 38.380970434354857], [-90.64294993297338, 38.380964035097385], [-90.643117658010141, 38.380951141988859], [-90.643284377201127, 38.380931786093967], [-90.643449688853721, 38.380906014048776], [-90.64361319466768, 38.380873887948432], [-90.643774500695244, 38.380835485197387], [-90.643933218290485, 38.380790898322914], [-90.644088965046038, 38.380740234752047], [-90.644241365714677, 38.380683616552737], [-90.644390053113625, 38.380621180139613], [-90.644534669009488, 38.380553075945166], [-90.644674864981468, 38.380479468057281], [-90.644810303261025, 38.3804005338237], [-90.644940657545717, 38.380316463424677], [-90.645065613785476, 38.380227459414577], [-90.645184870939246, 38.380133736233795], [-90.645298141700337, 38.380035519691894], [-90.6454051531885, 38.379933046423517], [-90.645505647607351, 38.379826563318048], [-90.64559938286537, 38.379716326924708], [-90.645686133158918, 38.379602602834311], [-90.645765689516153, 38.379485665039255], [-90.645837860300233, 38.379365795273316], [-90.645902471670723, 38.37924328233273], [-90.645959368002181, 38.379118421380348], [-90.646008412258709, 38.378991513234389], [-90.646049486323818, 38.378862863643654], [-90.646082491284531, 38.378732782550841], [-90.646107347669428, 38.378601583345741], [-90.646123995639556, 38.378469582110185], [-90.681812121406509, 38.002855712080027], [-90.681820663991914, 38.002714926225892], [-90.681819919332568, 38.00257397942601], [-90.681809889507221, 38.002433255001819], [-90.681790601846274, 38.002293135667749], [-90.681762108857114, 38.002154002490506], [-90.681724488080533, 38.0020162338527], [-90.681677841879477, 38.001880204423841], [-90.681622297159976, 38.001746284141554], [-90.681558005025579, 38.001614837205537], [-90.681485140366, 38.001486221087255], [-90.6814039013809, 38.001360785557871], [-90.681314509040632, 38.001238871737193], [-90.681217206484831, 38.001120811166146], [-90.681112258360969, 38.00100692490529], [-90.68099995010428, 38.000897522661859], [-90.680880587161411, 38.000792901947776], [-90.680754494159544, 38.000693347270605], [-90.68062201402347, 38.000599129360154], [-90.680483507043007, 38.000510504432384], [-90.68033934989316, 38.00042771349279], [-90.680189934609885, 38.000350981681244], [-90.68003566752401, 38.00028051765986], [-90.679876968156492, 38.000216513045771], [-90.679714268077731, 38.000159141890137], [-90.679548009734148, 38.000108560205049], [-90.679378645245421, 38.000064905539347], [-90.679206635175163, 38.000028296604739], [-90.679032447278956, 37.99999883295304], [-90.678856555232727, 37.999976594705572], [-90.678679437344954, 37.999961642335386], [-90.678501575256547, 37.999954016502777], [-90.678323452631432, 37.999953737944836]]]};
var doubleLayer = PolygonOut.coordinates;
$(document).ready(function CleanIt() {
for (var s = 0; s < doubleLayer.length; s++)
{
for (var i = doubleLayer[s].length; i--;)
{
var temp = doubleLayer[s][i][0];
doubleLayer[s][i][0] = doubleLayer[s][i][1];
doubleLayer[s][i][1] = temp;
doubleLayer[s][i] = new google.maps.LatLng(doubleLayer[s][i][0], doubleLayer[s][i][1]);
doubleLayer[s].concat(doubleLayer[i]);
}
}
var compPoly = new google.maps.Polygon({
paths: doubleLayer,
strokeColor: '#e88e19',
strokeOpacity: 0.7,
strokeWeight: 2,
fillColor: '#247fb8',
fillOpacity: 0.35
});
compPoly.setMap(map);
});
</script>

Failed to execute 'setSelectionRange' on 'HTMLInputElement'

I have the following error an simle "number" input field in Chrome (ver. 33 =>) and other webkit browsers
<input type="number" name="number">
Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input
element's type ('number') does not support selection.
I tested in FF & IE (10=>) and working well
I found the following issue in chromium project:
https://code.google.com/p/chromium/issues/detail?id=346270
any idea?
thank you!
Yes, this is an webkit bug, try this solution:
Jsfiddle demo
Code:
<div class="container">
<form role="form">
<div class="form-group">
<label for="tel">tel</label>
<input type="tel" class="form-control" id="tel" placeholder="tel"/>
</div>
</form>
</div>
<script>
$("#tel").mask("(99) 999-9999");
$("#tel").on("blur", function() {
var last = $(this).val().substr( $(this).val().indexOf("-") + 1 );
if( last.length == 3 ) {
var move = $(this).val().substr( $(this).val().indexOf("-") - 1, 1 );
var lastfour = move + last;
var first = $(this).val().substr( 0, 9 );
$(this).val( first + '-' + lastfour );
}
});
</script>

Argument error in Flex when trying to access xml data

I have a Flex application which shows map .I can also ZoomIn or ZoomOut throughout the map.Currently i am accessing the zoom values from xml file,
Code Below.
Code for accessing XML file.
private var xmlProperties:XML;
private function init():void {
sendRequest("properties.xml", propertyFileLoaded);
}
private function propertyFileLoaded(evt:ResultEvent):void {
showBusy(false);
xmlProperties = XML(evt.result);
.......
.......
}
Mxml part for accessing zoom levels.
<esri:LOD level="8" resolution="{xmlProperties..layer.(#name == 'LAYER_8').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_8').#y}" />
<esri:LOD level="9" resolution="{xmlProperties..layer.(#name == 'LAYER_9').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_9').#y}" />
<esri:LOD level="10" resolution="{xmlProperties..layer.(#name == 'LAYER_10').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_10').#y}" />
<esri:LOD level="11" resolution="{xmlProperties..layer.(#name == 'LAYER_11').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_11').#y}" />
<esri:LOD level="12" resolution="{xmlProperties..layer.(#name == 'LAYER_12').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_12').#y}" />
<esri:LOD level="13" resolution="{xmlProperties..layer.(#name == 'LAYER_13').#x}" scale="{xmlProperties..layer.(#name == 'LAYER_13').#y}" />
XML Data.
.....
.....
<layer name="LEVEL_10" x="152.87405657041106" y="577790.554289" />
<layer name="LEVEL_11" x="76.43702828507324" y="288895.277144" />
.....
.....
Previously i have hard coded the zoom level values like this,
<esri:LOD level="7" resolution="453.4534" scale="3.45346345" />
But when i tried to access values from XML its showing error ,
Argument Error:Error #2004: One of the parameter is invalid.
How to solve this.
Any help is appreciated.