Hello I am creating Geoserver view to view my result and for zoom to result. My Sql Query is like SELECT * FROM geotable WHERE gid IN (%gid%)  View Parameters to Query like 1,2,3   Regular Expression like '^[\w\d\s]+$'  My Zoom function like       function binddata(data) {         myObject = JSON.parse(data.d);         gid = [];          for (var i = 0; i &lt; myObject.length; i++) {             gid.push(myObject[i].gid);         }         //var plcd = plcd1[0];         ZoomtoParcelsByAcers(gid, SearchResultsLayer); }   //Function to escape comma in viewparameters     String.prototype.replaceAll = function (search, replacement) {         var target = this;         return target.replace(new RegExp(search, 'g'), replacement);     };      function EscapeCommasSemiColons(input) {         return input.toString().replaceAll(",", "\\,");     }   function ZoomtoParcelsByAcers(gid, SearchResultsLayer) {         $.ajax({              url: 'http://localhost:8080/geoserver/plotgeo/ows?service=WFS&amp;version=1.0.0&amp;request=GetFeature&amp;typeName=plotgeo:vwnew&amp;maxFeatures=5000&amp;outputFormat=text/javascript',             contentType: 'application/json',             dataType: 'jsonp',             jsonpCallback: "parseResponse",             data: {                  viewparams: "gid:" + EscapeCommasSemiColons(gid)             },              success: function (response) {                  search(response);             }         });   }   When i pass multiple parameters in geoserver it is working fine. When i am using above code to zoom to result i am gettin Error like      **&lt;ServiceException&gt;       java.lang.RuntimeException: java.io.IOException java.io.IOExceptionInvalid value for parameter gid &lt;/ServiceException&gt;**   Can anyone help what is error in it.
65927
I am trying to zoom plot numbers.Plot numbers like 1 10-12 13/P road 20(A) 100&amp;102 and etc.I am able to zoom to all combination plot numbers except 1,2,3.when I pass such value its trowing error:  1 feature types requested, but found 2 view params specified  geoserver sql view is:  select * from plotboundary where nmindar='%nmindar%' and plno='%plno%'   default values and validation are  Name  | Default Value   | validation  nmidar| Hanagawadi I A  | ^[\w\d\s]+$  plno  |  100,102&amp;103    | ^[ A-Za-z0-9_ *@.\/#&amp;+-\,()-_]*$   ajax function:   $.ajax({             url: 'http://XX.168.1.XX:8089/geoserver/XX/ows?service=WFS&amp;version=1.0.0&amp;request=GetFeature&amp;typeName=XX:vwplot&amp;maxFeatures=5000&amp;outputFormat=text/javascript',             contentType: 'application/json',             dataType: 'jsonp',             jsonpCallback: "parseResponse",             data: {                 viewparams: "nmindar:" + nmindar + ";plno:" + plno             }   Can any one tell me how to pass value to viewparams in geoserver, value includes comma. For example as mentioned above "100,102&amp;103" is a single value(plot number).Here   comma is not a separator.
66399
I have the following code:  const string Sql =      @"select distinct [name]        from tblCustomers        left outer join tblCustomerInfo on tblCustomers.Id = tblCustomerInfo.CustomerId         where (tblCustomer.Name LIKE '%@SEARCH%' OR tblCustomerInfo.Info LIKE '%@SEARCH%');";  using (var command = new SqlCommand(Sql, Connection)) {            command.Parameters.AddWithValue("@SEARCH", searchString);     ... }   This does not work, I tried this as well:  const string Sql =      @"select distinct [name]       from tblCustomers       left outer join tblCustomerInfo on tblCustomers.Id = tblCustomerInfo.CustomerId        where (tblCustomer.Name LIKE @SEARCH OR tblCustomerInfo.Info LIKE @SEARCH );";  using (var command = new SqlCommand(Sql, Connection)) {            command.Parameters.AddWithValue("@SEARCH", "'%" + searchString + "%'");     ... }   but this does not work as well. What is going wrong? Any suggestions?
90240
I have the below code:  public class CallOutForGet {      HttpRequest request=new Httprequest(); http http=new http(); request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals'); request.setmethod('GET');  HttpResponse response=http.send(request);  if(response.getStatusCode()==200){      Map&lt;String,Object&gt; results= (Map&lt;String,Object&gt;)JSON.deserializeUntyped(response.getBody());      List&lt;object&gt; animals=(List&lt;object&gt;)results.get('animals');     System.debug('Received Animals************');     for(object anim:animals){         System.debug(anim);     } }  }   This error at line -  request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals');  says expecting right parenthesis.
50537
I have PG server (9.0.4) installed on Debian x86. In one of my tables I use numeric(6,1):  CREATE TABLE mytable(name text, numfield numeric(6,1))   Also index created for this field:  CREATE INDEX mytable_numfield_idx ON mytable USING btree (numfield);   Everything is going fine if I use this field with real numeric value. As I see the query uses the index:  EXPLAIN ANALYZE SELECT * FROM kodiall WHERE kodgo=123.0      Index Scan using mytable_numfield_idx on mytable  (cost=0.00..8.27 rows=1   width=193) (actual time=0.085..0.087 rows=1 loops=1)      Index Cond: (numfield = 123.0)      Total runtime: 0.131 ms   But the index is ignored for some reason if I use 0.0 or NULL as condition value:  EXPLAIN ANALYZE SELECT * FROM kodiall WHERE numfield=0.0 --EXPLAIN ANALYZE SELECT * FROM kodiall WHERE numfield=NULL      Seq Scan on mytable  (cost=0.00..57.80 rows=1080 width=193) (actual   time=0.033..1.853 rows=1088 loops=1)      Filter: (numfield = 0.0)   What wrong here? Is 0.0 not a numeric value?  In real query I use LEFT JOIN with numfield and values in joined table can be NULL.
81188
Just wondering if there is anything built-in to Javascript that can take a Form and return the query parameters, eg: "var1=value&amp;var2=value2&amp;arr[]=foo&amp;arr[]=bar..."  I've been wondering this for years.
122252
I am new to GeoJSON. I have a GeoJSON features collection as shown and would like to store it in postgres table (testtable). My postgres table has a serial id and geometry column.  {     "type": "FeatureCollection",     "features": [         {             "type": "Feature",             "geometry": {                 "type": "Point",                 "coordinates": [                     2565453.1826721914,                     -3835048.659760314                 ]             }         },         {             "type": "Feature",             "geometry": {                 "type": "LineString",                 "coordinates": [                     [                         2727584.7219710173,                         -3713449.1942418693                     ],                     [                         2732476.691781269,                         -3992291.473426192                     ]                 ]             }         },         {             "type": "Feature",             "geometry": {                 "type": "Polygon",                 "coordinates": [                     [                         [                             2442627.9025405287,                             -3705499.954308534                         ],                         [                             2425506.008204649,                             -3886502.837287831                         ],                         [                             2425506.008204649,                             -3886502.837287831                         ],                         [                             2555143.2081763083,                             -3910962.686339088                         ],                         [                             2442627.9025405287,                             -3705499.954308534                         ]                     ]                 ]             }         }     ] }   I would like to insert the GeoJSON data into the table testtable.   How do I go about it?  I am using postgres version 9.3.5 with postgis version 2.1.3    I have been directed to previously asked questions which answer how to store a single feature eg a point or polygon. My question asks how to save multiple features in the GeoJSON file. By multiple features I mean a mixture of points, lines and polygon feature types in one file.
40938
After I posted this question, I found a similar post that seemed to answer it: . I'll leave this in place for now, as I am not sure how to mark my own question as a duplicate  In attempting to debug a SOQL query error, I encountered a strange behavior with Database.query and bind variables. Specifically, when I run this code:  String userQuery = 'SELECT Id FROM User'; if (true) {     List&lt;String&gt; firstNames = new List&lt;String&gt;{'James','Joe'};     userQuery += ' WHERE FirstName IN :firstNames'; } Database.query(userQuery);   the Database.query statement executes with no errors, despite the fact that the variable firstNames does not exist in its context. However, when I add an else clause:  String userQuery = 'SELECT Id FROM User'; if (true) {     List&lt;String&gt; firstNames = new List&lt;String&gt;{'James','Joe'};     userQuery += ' WHERE FirstName IN :firstNames'; } else {     List&lt;String&gt; firstNames; } Database.query(userQuery);   I receive a null object reference exception. It seems like Salesforce is checking to see if the variable is only declared once beforehand and, if so, uses its value in the context it was declared. This seems strange to me, so I was wondering if anybody here has any insight into what is going on under the hood.
73621
Is there any way to create the query parameters for doing a GET request in JavaScript?  Just like in Python you have , which takes in a dictionary (or list of two tuples) and creates a string like 'var1=value1&amp;var2=value2'.
113984
I just try to visualize some points using GeoServer to publish them as WMS and bind this WMS to my Openlayers website using the GeoServer internal Heatmap process to visualize it. I don't want to use the Openlayers Heatmap function.   But there seem to be some problems, look here:    I'm using this Openlayers implementation to bind my WMS URL:    Changing the params to:  params: {'LAYERS': 'test:points','TILED': true,'STYLES': 'heatmap'},   And using this as SLD to define the Heatmap:    Any ideas why this happens?
102965
I'm having problems with a WFS GetFeature request. I'm using OpenLayers with an OSM map as base layers which use the Google projection. Overlaying the layer with WMS works perfect. When I do a request to return all features within the bounds of a polygon, no features are found.  My layer uses EPSG:28992. the base layer uses: EPSG:900913  My layer configuration in GeoServer:    When I set the declared SRS to EPSG:900913 and set "SRS handling" to "Reproject native to declared" it works fine, but I need OpenLayers to reproject it, not GeoServer.  Below is an example request I would do. I think the problem is that GeoServer does not convert the spatial filter to the native SRS.  http://mydomain.com/wfs?request=GetFeature&amp;version=1.1.0&amp; srsName=epsg:28992&amp; typeName=Namespace:Layer1&amp; propertyName=(*)&amp; CQL_FILTER=year = 2011 and INTERSECTS(geometry,POLYGON((565585.61613069 6816272.786200799,565585.61613069 6817032.3791692,564362.62367835 6817032.3791692,564362.62367835 6816272.786200799,565585.61613069 6816272.786200799)))&amp; outputFormat=GMl2&amp;   Update  I just tried re-projecting some points from OpenLayers (EPSG:900913) via proj4js to EPSG:28992 (PostgreSQL and GeoServer). I took 3 points and  compared them. They all showed an offset.   Converted: POINT(233492,24349424947 582191,0681508556)  In Database: POINT(233530,852147064 582315,680920578)  Difference x: 38,60865281453 Difference y: 124,6127697224 Converted: POINT(133459,1980658749 455770,7481867363)  In Database: POINT(133486,356985081 455879,67223342)  Difference x: 27,1589192061 Difference y: 108,9240466837 Converted: POINT(176920,43262818802 317930,36182729155)  In Database: POINT(176954,154083767 318023,515324756)  Difference x: 33,72145557898 Difference y: 93,15349746445   If the offset was constant I could correct it. Now I'm not sure if the offset is caused by GeSserver or by proj4js. I'm guessing proj4js since the WMS layer does not show any offset.
115101
I am getting one value from webservice as a string (KM value , say 500000) . I want to display that in an inline vf page as 50,000. How to achieve this in apex controller. I am displaying the valu in a apex datatable as column value.  Please help me out  Eg ; 50000 should be 50,0000 OR 5000000 should be 5,000,000
35663
My controller code is as follows -          for(String resStr : responseArray){             if(resStr.indexOf('r_error_str') != -1){                 responseString += resStr.substring(resStr.indexOf('=') + 1);                  responseString += '\n';             }         }   but when i display this 'responseString ' String using 'apex:outputLabel or apex:outputText or as Exception message '\n' is not converting in new line. Whole String is coming in one line.  Can anyone explain why is this happining
30848
My requirement wholly depends on the QUERY.  I am filtering my gridview on the basis of three parameters.   Project_name (Always required) Date (Not always) Vehicle_No (Not always)   So, what my requirement is,      With project_name either any one can be used for filtering my gridview.   Currently my debugged query works exactly fine for any two parameters.  Below is my debugged query:-  SELECT DISTINCT sv.mkey, vehicle_no,                TO_CHAR (date_in, 'dd-MM-yyyy')             || ' &amp; '             || time_in vehicleindate_time,                TO_CHAR (date_out, 'dd-MM-yyyy')             || ' &amp; '             || time_out vehicleoutdate_time,             gate_no_in || ' &amp; ' || gate_no_out ingate_outgateno,             gd.good_type goods_type, net_weight netweight,                TO_CHAR (challan_date, 'dd-MM-yyyy')             || ' &amp; '             || challan_no challandate_no,             remark_in remarkin, NULL receipt_no, date_in        FROM xxcus.xxgid_supinv sv,             xxcus.xx_supinv_goodtype gd,             xxcus.xxacl_xxgid_user_mst ms       WHERE (gd.good_type_code(+) = sv.good_type)         AND (       sv.project_id = '1368'                 AND TO_CHAR (date_in, 'dd-MM-yyyy') = '26-11-2015'              OR vehicle_no = '0'             )         AND sv.delete_flag = 'N'    ORDER BY date_in DESC, vehicle_no   The above query shows me the exact result for project_name and Date which I entered.  But when I add the third parameter say Vehicle_no it doesn't show the data for that exact vehicle_no it still shows me the same data which I looked for 2 parameters.  I am using Oracle for the database.  LATEST UPDATE WHICH IS NOT WORKING  I am confused as how to deal with the query, as Balazs' solution was working fine when I selected, Project_name, Date and then vehicle_no (not necessary). But it was not fetching proper result when I took first as Project_name, and Vehicle_no. Any guesses why?     The issue  is when I only filter with Project_name and Vehicle_no the date_column value comes as 0 so it doesn't show me any row, which is incorrect as I have data for that Project_name and Vehicle_no.   I have used Balaz's second query for the solution which is below  WHERE (gd.good_type_code(+) = sv.good_type)     AND (       sv.project_id = '1368'             AND TO_CHAR (date_in, 'dd-MM-yyyy') = '26-11-2015'          AND vehicle_no = decode(:vehicle_no, '0', vehicle_no, :vehicle_no)         )
114531
I need to serialize a list of SObject without omission null values. This string I need for a later usage in JavaScript. Structure is crucial, because I need to construct a table out of it. The structure is very dynamic. Different SObjects may lead to different fields and therefore different columns. Missing values will corrupt all the output and are unacceptable.  As it stands, in current versions JSON.serialize() will not output null values. There are already some questions about this raised, but either the answers there are incorrect or I'm doing something wrong to apply them right:       As far as I understand, Apex version 28.0 and newer should have no null values and version 27.0 and older should have them. But I can't make it work. There was an issue that the JSON.serialized() was not versioned right but as to  it should be working now.   So I've created this helper-class:  public class elfApi27 {      public static string dump0(Object o) {         return system.JSON.serializePretty(o);      } }   Setting the version like this in the xml  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"&gt;     &lt;apiVersion&gt;27.0&lt;/apiVersion&gt;     &lt;status&gt;Active&lt;/status&gt; &lt;/ApexClass&gt;   tested it via execute anonymous like this (consider xl.log as system.debug)  Account a = new Account(name='test'); xt.log( elfApi27.dump0(a) );   I have tried all the versions from 32.0 down to 24.0 but the output stays rock-solid like this:  DB Callout Profile Code Escape   32.0 APEX_CODE,WARN;APEX_PROFILING,WARN;CALLOUT,WARN;DB,WARN;SYSTEM,WARN 19:09:02.119 (119823175)|EXECUTION_STARTED 19:09:02.119 (119833395)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 19:09:02.132 (132802344)|USER_DEBUG|[230]|WARN|"{    "attributes" : {       "type" : "Account"    },    "Name" : "test" }" 19:09:02.132 (132848199)|CODE_UNIT_FINISHED|execute_anonymous_apex 19:09:02.134 (134336841)|EXECUTION_FINISHED    Am I misinterpreting the answers?  Is there any way to have a full verbose serialization of objects?
56801
I have a function like this:  DROP FUNCTION IF EXISTS user_repo // CREATE FUNCTION user_repo(user_id INT) RETURNS VARCHAR(20) BEGIN     DECLARE vote_value mediumint;     DECLARE score mediumint;      SELECT coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)       INTO vote_value, score     FROM reputations     WHERE owner_id = user_id       AND date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 WEEK));      RETURN CONCAT_WS(',', vote_value, score); END;//   It works as well. Now I want to also pass another parameter to the function to determine the time range. I mean I want to pass a string instead of  WEEK. Here is my new function:  DROP FUNCTION IF EXISTS user_repo // CREATE FUNCTION user_repo(user_id INT, range VARCHAR(10)) RETURNS VARCHAR(20) BEGIN     DECLARE vote_value mediumint;     DECLARE score mediumint;      SELECT coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)       INTO vote_value, score     FROM reputations     WHERE owner_id = user_id       AND date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 range));      RETURN CONCAT_WS(',', vote_value, score); END;//   But it throws this error:     The following query has failed:   CREATE  DEFINER=`root`@`localhost` FUNCTION `user_repo`(`user_id` INT,                 `range` VARCHAR(10) CHARSET utf8)        RETURNS VARCHAR(20) CHARSET utf8mb4        NOT DETERMINISTIC        CONTAINS SQL SQL        SECURITY DEFINER BEGIN DECLARE vote_value mediumint; DECLARE score mediumint; SELECT  coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)     INTO  vote_value, score     FROM  reputations     WHERE  owner_id = user_id       AND  date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 range)); RETURN CONCAT_WS(', ', vote_value, score); END      MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'range)); RETURN CONCAT_WS(',', vote_value, score); END' at line 9   Does anybody what's wrong?
102695
I am quite new to Javascript. I have made a html script that includes services I published to ArcGIS for server. It all does exactly what I want and I made it by copying working scripts together and getting help from more experienced scripters. I want to finetune my service by adding a legend. Unfortunately I am not able to create a working script. I have added the parts of my script I assume that are necessary to create my legend. Does anybody see what I am doing wrong?        &lt;script&gt;         var map;         var wmsLayer;         var URL;         var legend;         require(["dojo/query", "esri/map", "esri/layers/WMSLayer", "esri/dijit/Legend", "esri/config", "dojo/domReady!"],         function (query, Map, WMSLayer, Legend, esriConfig) {          esriConfig.defaults.io.proxyUrl = "/proxy/proxy_gcx.php";            map = new Map("map", {               basemap: "topo",               center: [5.5, 52.485],               minZoom: 8,               maxZoom: 13,               zoom: 8,               slider: true           });            wmsLayer = new WMSLayer("URL", {               format: "png",               visibleLayers: ["31", "30", "29", "28"]           });            map.on("layer-add", function (results) {               //add the legend               legend = new Legend({                   map: map,                   layerInfos: [{                       layer: results,                       title: "test"                   }]               }, "legendDiv");               legend.startup();           });             map.addLayer(wmsLayer);       });     &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div id="map"&gt;     &lt;/div&gt;     &lt;div id="legendDiv"&gt;     &lt;/div&gt; &lt;/body&gt;   EDIT: I have edited the code. I am still not done. It does give me a legend on my browser but it says there is no content in there. On my arcgis server manager there is a legend.
104755
I have a gridview and I need to sort its elements when the user clicks on the header. Its datasource is a List object.  The aspx is defined this way :  &lt;asp:GridView ID="grdHeader" AllowSorting="true" AllowPaging="false"      AutoGenerateColumns="false" Width="780" runat="server"  OnSorting="grdHeader_OnSorting" EnableViewState="true"&gt;     &lt;Columns&gt;         &lt;asp:BoundField DataField="Entitycode" HeaderText="Entity" SortExpression="Entitycode" /&gt;         &lt;asp:BoundField DataField="Statusname" HeaderText="Status" SortExpression="Statusname" /&gt;         &lt;asp:BoundField DataField="Username" HeaderText="User" SortExpression="Username" /&gt;     &lt;/Columns&gt; &lt;/asp:GridView&gt;   The code behind is defined this way : First load :  protected void btnSearch_Click(object sender, EventArgs e) {     List&lt;V_ReportPeriodStatusEntity&gt; items = GetPeriodStatusesForScreenSelection();     this.grdHeader.DataSource = items;     this.grdHeader.DataBind(); }   when the user clicks on headers :  protected void grdHeader_OnSorting(object sender, GridViewSortEventArgs e) {     List&lt;V_ReportPeriodStatusEntity&gt; items = GetPeriodStatusesForScreenSelection();     items.Sort(new Helpers.GenericComparer&lt;V_ReportPeriodStatusEntity&gt;(e.SortExpression, e.SortDirection));     grdHeader.DataSource = items;     grdHeader.DataBind(); }   My problem is that e.SortDirection is always set to Ascending. I have webpage with a similar code and it works well, e.SortDirection alternates between Ascending and Descending.  What did I do wrong ?