Sort order file when sent to xml - mysql

I have the following statement:
$query = "SELECT * FROM aprstrack WHERE callsignSSID = 'VE9SC-9' order by reporttime desc limit 30 ";
It works but I am feeding the results to a xml file that needs the order reversed to what is displayed.
The display looks like this:
<?xml version="1.0" ?>
- <markers>
<marker call="VE9SC-9" lat="46.1088" lng="-64.8708" datetime="2012-01-20 20:26:33" course="" Speed="28" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.1038" lng="-64.8633" datetime="2012-01-20 20:25:23" course="" Speed="26" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.1038" lng="-64.8625" datetime="2012-01-20 20:25:19" course="" Speed="16" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.1037" lng="-64.862" datetime="2012-01-20 20:25:11" course="" Speed="10" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.1035" lng="-64.8622" datetime="2012-01-20 20:25:05" course="" Speed="14" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.0978" lng="-64.86" datetime="2012-01-20 20:24:18" course="" Speed="18" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.0943" lng="-64.8407" datetime="2012-01-20 20:21:40" course="" Speed="40" alt="" Icon="/P" />
<marker call="VE9SC-9" lat="46.0977" lng="-64.8178" datetime="2012-01-20 20:19:08" course="" Speed="12" alt="" Icon="/P" />
</markers>
The newest being listed on the top, what I need is the oldest listed on the top.
I have tried desc & ASC but that will not work what needs to be done ? I have looked on-line and I can not find an answer.
Thanks
Stephen

MySQL does the ordering first and then limits the results. That is why you would get the 30 oldest results. You need to do a subquery such that ordering happens after you have pulled the 30 newest records:
$query = "SELECT * FROM (SELECT * FROM aprstrack WHERE callsignSSID = 'VE9SC-9' order by reporttime desc limit 30) ORDER BY reporttime ASC";

Related

Autodesk Forge ../photo-to-3d/v1/file Error Code 14

Good Evening,
im geting the following error
{
"Usage": "0.55849504470825",
"Resource": "/file",
"Error": {
"code": "14",
"msg": "Specified values are invalid"
}
}
im trying to post a survey file to to the photo scene - following this documentation the file i have given the extension type .gcp and formatted it as a xml as shown on the example
<?xml version="1.0" encoding="UTF-8"?>
<surveydata coordinatesystem="LL84" description="Local coordinatesystem; meters" epsgcode="27700">
<markers>
<marker id="1" name="C2">
<images>
<image name="I100_0413_0027.jpg" xpixel="452" ypixel="401"/>
<image name="I100_0413_0028.jpg" xpixel="454" ypixel="1105"/>
<image name="I100_0413_0029.jpg" xpixel="464" ypixel="1840"/>
<image name="I100_0413_0030.jpg" xpixel="455" ypixel="2564"/>
</images>
<gcp x="539840.423" y="263277.897" z="16.097" checkpoint="false"/>
</marker>
<marker id="2" name="C3">
<images>
<image name="I100_0413_0009.jpg" xpixel="1887" ypixel="488"/>
<image name="I100_0413_0010.jpg" xpixel="1877" ypixel="1236"/>
<image name="I100_0413_0011.jpg" xpixel="1868" ypixel="1958"/>
<image name="I100_0413_0012.jpg" xpixel="1860" ypixel="2681"/>
<image name="I100_0413_0013.jpg" xpixel="1850" ypixel="3400"/>
</images>
<gcp x="539783" y="263219.485" z="16.511" checkpoint="false"/>
</marker>
<marker id="3" name="C4">
<images>
<image name="I100_0413_0036.jpg" xpixel="4255" ypixel="348"/>
<image name="I100_0413_0037.jpg" xpixel="4211" ypixel="1049"/>
<image name="I100_0413_0038.jpg" xpixel="4167" ypixel="1758"/>
<image name="I100_0413_0039.jpg" xpixel="4125" ypixel="2460"/>
<image name="I100_0413_0040.jpg" xpixel="4063" ypixel="3168"/>
</images>
<gcp x="539845.368" y="263230.711" z="15.852" checkpoint="false"/>
</marker>
</markers>
</surveydata>
on the creation of the scene i have set format=rcs-scenetype=aerial
this is the first time i have tried a survey file and i'm unsure what 'values' are invalid, could anyone help?
According to Survey File Example in documentation, when you specify coordinate system as "LL84":
<surveydata coordinatesystem="LL84" ...
it expects in gcp the long, lat and alt:
<gcp long="38.014125" lat="-122.540530" alt="2010.200000" checkpoint="false"/>
In your case, you specify the gcp as x,y,z:
<gcp x="539840.423" y="263277.897" z="16.097" checkpoint="false"/>
Thus, try to change the coordinate system as "XYZ":
<surveydata coordinatesystem=“XYZ” ...
Although documentation states that "only LL84 is supported for now.", this should do the trick.

XML to MySQL and SQLite

I need to load an XML file into a MySQL database. I also need to load the XML file for a SQLite database but I do not know how to do it.
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01">
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
<RecordStop Timestamp="" />
</CommunicationLog>

How to generate a component multiple times in JSF?

I need to highlight the boundary of a country, for which I am using GMaps4JSF aimed at integrating Google maps with JSF.
To draw polygon and polylines, the library provides polygonComponent
polylineComponent components.
I have loaded the data points from the fusion tables into our own DB.
<m:map width="1000px" height="500px">
<m:polygon lineWidth="4">
<m:point latitude="35.555618" longitude="61.27652" />
<m:point latitude="35.517635" longitude="61.183601" />
<m:point latitude="35.348602" longitude="61.105827" />
<m:point latitude="35.281799" longitude="61.096241" />
<m:point latitude="35.23624" longitude="61.099781" />
<m:point latitude="35.17659" longitude="61.116379" />
<m:point latitude="35.163876" longitude="61.136036" />
<m:point latitude="35.132072" longitude="61.13166" />
<m:point latitude="35.085823" longitude="61.115547" />
<m:point latitude="35.016937" longitude="61.077492" />
<m:point latitude="34.879433" longitude="61.051102" />
<m:point latitude="34.789436" longitude="60.976654" />
<m:point latitude="34.650757" longitude="60.853191" />
<m:point latitude="34.567631" longitude="60.832909" />
<m:point latitude="34.561794" longitude="60.77916" />
<m:point latitude="34.556099" longitude="60.73999" />
<m:point latitude="34.544716" longitude="60.723877" />
....... and so on to a very very large extent
</m:polygon>
</m:map>
which renders as
It would be stupidity to manually enter values into those latitude and longitude attributes of the polygon inside the map component.
How can I achieve this so that I have to write only this much...
<m:map width="1000px" height="500px">
<m:polygon lineWidth="4">
<m:point latitude=" " longitude=" " />
</m:polygon>
</m:map>
just like we have a dynamic datatable in which rows are generated dynamically (multiple rows). How can these <m:point latitude=" " longitude=" " /> be generated multiple times?
You can use <c:forEach> for that.
<m:polygon lineWidth="4">
<c:forEach items="#{bean.points}" var="point">
<m:point latitude="#{point.latitude}" longitude="#{point.longitude}" />
</c:forEach>
</m:polygon>
The <ui:repeat> is unsuitable as it doesn't build the component tree. A theoretical alternative would be to use a fictive <m:points> component from the GMaps4JSF, if it has one.
See also:
JSTL in JSF2 Facelets... makes sense?

API search in mediawiki don't work

I want to make search with wikimedia API in my local mediawiki.
When I try this url on the wikipedia API online
http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=fran&srprop=timestamp
I get this
<?xml version="1.0"?>
<api>
<query-continue>
<search sroffset="10" />
</query-continue>
<query>
<searchinfo totalhits="13454" />
<search>
<p ns="0" title="Fran" timestamp="2013-07-10T11:08:52Z" />
<p ns="0" title="Hurricane Fran" timestamp="2013-10-27T17:30:58Z" />
<p ns="0" title="Fran Drescher" timestamp="2013-12-10T01:10:38Z" />
<p ns="0" title="Fran Walsh" timestamp="2013-11-19T04:12:29Z" />
<p ns="0" title="List of The Nanny characters" timestamp="2013-11-29T17:26:10Z" />
<p ns="0" title="Fran González" timestamp="2013-07-16T14:44:50Z" />
<p ns="0" title="Fran Landesman" timestamp="2013-08-02T19:36:03Z" />
<p ns="0" title="Fran Mérida" timestamp="2013-12-08T23:27:28Z" />
<p ns="0" title="Tropical Storm Fran" timestamp="2012-11-11T18:44:02Z" />
<p ns="0" title="Fran (film)" timestamp="2013-10-30T11:49:53Z" />
</search>
</query>
</api>
When I type the same url in my mediawiki API with dump of wikipedia:
http://www.mylocalhost.com/begoo/assets/mediawiki/api.php?action=query&list=search&srsearch=fran&srprop=timestamp
I get this
<?xml version="1.0"?>
<api>
<query>
<search />
</query>
</api>
I correctly installed all dump of wikipedia and only the API OpenSearch Work fine,not the API Search.What is wrong?

Load random image from XML file

I have almost non-existanl knowledge on AS3/Flash CS5.
I need to load a random image from an XML file with the list of urls.
Every time I load the movie, it should load a random image.
Any idea how to do this?
I'm assuming this is what your xml file looks like:
<images>
<image url="http://url_to_image/1.png" width="100" height="100" />
<image url="http://url_to_image/2.png" width="100" height="100" />
<image url="http://url_to_image/3.png" width="100" height="100" />
<image url="http://url_to_image/4.png" width="100" height="100" />
<image url="http://url_to_image/5.png" width="100" height="100" />
</images>
And here's what you'll do to get a random one from those:
private function randomImage(imagesXML:XML):Object {
var imageList:XMLList=imagesXML.image;
var imageCollection:XMLListCollection=new XMLListCollection(imageList);
var random:int=Math.floor(Math.random() * imageCollection.length);
var r:Object={};
r.url=xmlCollection[random].#url;
r.width=Number(xmlCollection[random].#width);
r.height=Number(xmlCollection[random].#height);
return r;
}
And here's how you would call it:
private var x:XML=<images>
<image url="http://url_to_image/1.png" width="100" height="100" />
<image url="http://url_to_image/2.png" width="100" height="100" />
<image url="http://url_to_image/3.png" width="100" height="100" />
<image url="http://url_to_image/4.png" width="100" height="100" />
<image url="http://url_to_image/5.png" width="100" height="100" />
</images>;
var img:Object=randomImage(x);
Now you have img.url, img.width, img.height