| Author |  | 
      
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          
           | Posted: November 19 2014 at 12:02 | IP Logged |   |  
           | 
 |  
| dhoward wrote: 
 
    
    | 
      
       | Peter, 
 In the PH multi-editor, what do you get when you run the following functions:
 
 
| Code: 
 
    
    | 
      
       | ph_latlongdist(ph_number("51.4567405"),ph_number("5.6372489" ),ph_number("51.4589887"),ph_number("5.6342066")) |  |  |  and
 
 
| Code: 
 
    
    | 
      
       | ph_latlongdist(ph_number("51,4567405"),ph_number("5,6372489" ),ph_number("51,4589887"),ph_number("5,6342066")) |  |  |  
 Dave.
 
 |  |  |  
 SQLSTATE = 37000
 [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '(' on line 1
 
 
 However: running it as part of the macro (code1)
 Execution time: 0,004 seconds.
 The formula evaluates to: 9789,460432694224
 
 (code2)
 Execution time: 0,002 seconds.
 The formula evaluates to: 0,3269925583113723
 
 
 
 Edited by krommetje - November 19 2014 at 12:11
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          I made a small page which takes the original Lat/Lon and transfers it to google maps, this works OK....
           | Posted: November 19 2014 at 12:03 | IP Logged |   |  
           | 
 |  
 Edited by krommetje - November 19 2014 at 12:04
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: November 19 2014 at 12:28 | IP Logged |   |  
           | 
 |  
 Your multi-editor error is because the editor was in SQL mode (shift-F5) instead of PH Formula mode (shift-F6).
 
 However, your macro runs gives me the info I need. Code2 with an answer of 0,3269925583113723 is the correct value so you would use this format if you still want to do it within PowerHome (using the ph_number function to convert the lat/long with comma's instead of decimals for ALL the values).
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          So all values should be with a comma in my case. In case of US users, all values should be with a decimal point....
           | Posted: November 19 2014 at 12:33 | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          ph_latlongdist(ph_number("51,4567405"),ph_number("5,6372489"  ),ph_number(ph_getglobal_s("PLAT")),ph_number(ph_getglobal_s ("PLONG")))
           | Posted: November 19 2014 at 12:41 | IP Logged |   |  
           | 
 |  
 gives Formula Evaluation
 Execution time: 0,006 seconds.
 The formula evaluates to: 7160,365178893712
 
 
   
 
 PLAT and PLONG are the original GV's as sent by my droid... with decimal point. How do I substitue a decimal for a comma?
 
 Edited by krommetje - November 19 2014 at 13:07
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: November 19 2014 at 13:24 | IP Logged |   |  
           | 
 |  
 
 
| Quote: 
 
    
    | 
      
       | So all values should be with a comma in my case. In case of US users, all values should be with a decimal point.... |  |  |  
 Correct. Unless you want to change your Windows regional settings to match the US so you can use a decimal point.
 
 
 
| Quote: 
 
    
    | 
      
       | ph_latlongdist(ph_number("51,4567405"),ph_number("5,6372489"  ),ph_number(ph_getglobal_s("PLAT")),ph_number(ph_getglobal_s ("PLONG"))) 
 gives Formula Evaluation
 Execution time: 0,006 seconds.
 The formula evaluates to: 7160,365178893712
 |  |  |  
 Mixing the commas and decimals will give you the wrong values always. To substitute, use the ph_replaceall function. Your function above would look like this:
 
 
 
| Code: 
 
    
    | 
      
       | ph_latlongdist(ph_number("51,4567405"),ph_number("5,6372489" ),ph_number(ph_replaceall(ph_getglobal_s("PLAT"),".",",")),p h_number(ph_replaceall(ph_getglobal_s  ("PLONG"),".",","))) |  |  |  
 Dave.
 
 
 
 Edited by dhoward - November 19 2014 at 13:24
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave (and others)
           | Posted: November 28 2014 at 07:42 | IP Logged |   |  
           | 
 |  
 I've got it up and running for several days now but I've still got a problem with authenicating. I've got auth in web set to basic. Restarted (not reinit) PH but after some time, PH no longer accepts authenication....what can be the cause of this?
 
 Edited by krommetje - November 28 2014 at 07:43
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: December 06 2014 at 19:46 | IP Logged |   |  
           | 
 |  
 Not sure. When it stops accepting authentication, can you still hit the webserver from a browser and navigate through the PowerHome webpages? Also, what does the eventlog show for each failed attempt?
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave,
           | Posted: December 07 2014 at 02:39 | IP Logged |   |  
           | 
 |  
 I still can logon even with the http://username:password@...  format. PH just stops changing the GV's
 
 Peter
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: December 07 2014 at 11:24 | IP Logged |   |  
           | 
 |  
 What does the eventlog say for the web event and the entries after? If the web entry is ok and the GV does not update, Im suspecting a syntax error or some other problem.
 
 Let me know,
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave,
           | Posted: December 10 2014 at 09:10 | IP Logged |   |  
           | 
 |  
 I can send you my database or send me the sql to export the eventlog so i can send that. Whatever you see fit....
   | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: December 10 2014 at 19:40 | IP Logged |   |  
           | 
 |  
 Probably not necessary to send the whole database. A screenshot of the eventlog showing the web access entry and some of the before and after should be sufficient.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave,
           | Posted: December 15 2014 at 04:06 | IP Logged |   |  
           | 
 |  
 (took a little longer due to 2 deaths in the family)
 
 Here is a screenshot of the log:
 
   
 I still think this is an auth. problem however can't think what to do next: IP's whitelisted and auth set to basic...
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: December 15 2014 at 16:35 | IP Logged |   |  
           | 
 |  
 Very sorry to hear about your family. Its terrible anytime but even more so this time of year.
 
 Looking at your screenshot, the request doesnt have an "Authorization: Basic" section that would normally be included if you had supplied credentials on the URL line. This would put the issue with whatever http client you're using to access PowerHome with. If you compare this log entry to one that works, you should see the difference.
 
 However, you say that you've got the IP in the trusted IP section of the webserver configuration. If you could send a screenshot of the Trusted IP section or just copy/paste the data there I can verify that its formatted properly. With 92.69.213.73 set as trusted, you shouldnt need to include any authorization and it should just work.
 
 Let me know,
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave,
           | Posted: December 16 2014 at 01:55 | IP Logged |   |  
           | 
 |  
 Due to securityissues I will send the trusted IP-section in a PM on the board.
 
 Peter
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Dave,
           | Posted: August 09 2015 at 05:43 | IP Logged |   |  
           | 
 |  
 got a new phone yesterday and now all of a sudden PH says the formula is a syntax error...
 
 here is the log-entry:
 
 
 
| Code: 
 
    
    | 
      
       | Aug 09  2015       12:16:58       Formula  Error      Syntax Error in Formula: ph_setglobal_s(~"plat~",~"51.45676~")+ph_setglobal_s
 Aug 09  2015       12:16:58       Trusted  Web Access      From: 95.96.108.241 GET  /ph-cgi/eval?formula=ph_setglobal_s("plat","51.45676")%2bph_ setglobal_s("plong","5.637223")  HTTP/1.1 User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.0.1; SM-N910F Build/LRX22C) Host: powerhome.krommetje.nl:9600 Connection: Keep-Alive Accept-Encoding: gzip
 
 |  |  |  
 can you tell here what seems wrong? the formula and settings are the same...
 
 note: the boardbug has struck again!
 
 Edited by krommetje - August 09 2015 at 05:44
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Update in this matter:
           | Posted: August 09 2015 at 07:12 | IP Logged |   |  
           | 
 |  
 I Changed  the " into ' and all worked again.
 
   | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Peter,
           | Posted: August 12 2015 at 19:39 | IP Logged |   |  
           | 
 |  
 Glad to hear you got it going.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  |