Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Joe Ess

Bartender
+ Follow
since Oct 29, 2001
Joe likes ...
Mac OS X Linux Windows
Cows and Likes
Cows
Total received
16
In last 30 days
0
Total given
0
Likes
Total received
355
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joe Ess

So I ran into the same issue sending coordinates that end with a 0.  It looks like, rather than sending an HTML error response, the API sends a 301 response when it gets coordinates it doesn't like and my code doesn't handle that...
So apparently I'm sending too big a number.  The API doc says:

Please note that, for efficiency purposes, the API doesn’t support more than four decimal places of precision in coordinates. If you send a more precise coordinate, you’ll receive an error giving you the closest proper coordinate.


You can see above that the error I get is truncated to 4 decimal places.  The fact that the URL in the error message looks like the error was originating from localhost distracted me from this.  
I'm playing around with Angular, trying to create a weather forecast app.  I'm using the National Weather Service API for data.  There are 3 steps to retrieving a forecast:
1. get your latitude and longitude (the NWS doesn't offer geocoding, so we have to use a different api for this)
2. request the metadata ("points") for this location
3. using the points, request the forecast document.

Since this data resides on a server other than the one I'm working on, I need to proxy requests to the data servers.  I set up the proxy.conf.json like so:


Now, in my angular code, I make a request to the US Census Geocoder API:


The proxy rewrites this request and I get the latitude and longitude back.  The output from the proxy looks like:


Next, in my angular code, I perform the second step, taking the latitude and longitude and requesting the points from the NWS.  The URL I use looks like:


The output from the proxy is similar to the previous example, so it appears to do the correct thing rewriting the request:


However, I get a 404 error.  The weird thing is, the URL reported for the error isn't the one I requested nor is it the rewritten one.  

It's as if the proxy is trying to request the rewritten URL from localhost.

For another data point, I have another app in which I was working with another NWS API which basically goes by county (the API calls "zones").  Occasionally I will get failures when the service is overwhelmed.  The URL in those errors will be what I expect, the unrewritten URL with localhost:


Now, the API that uses zones doesn't require geocoding, so the app proxy config only has one entry for the https://api.weather.gov target.  This leads me to believe that I have configured the proxy incorrectly.  Is this the case or is there something else wrong?
Thanks



I knew nothing about Docker before reading this book and I found it a good introduction to the subject.  
There is a whole lot more to learn about containers, for example, it sidesteps Kubernetes (and rightly so, seeing as how that is a whole subject on its own).  That said, it is a solid starting point.
7 months ago

Ryan McGuire wrote:We're 95% (probably more) a Windows shop.



You make it sound like there's no Linux there!    The data center will spin up a Linux VM for a couple hundred bucks.

paul nisset wrote:I went through a bad/time wasting experience  with Docker for Windows on a Windows 10 laptop.



I tried Docker Toolbox on a maxed-out Windows workstation and had no end to problems.  I installed Docker on a Linux virtual machine on that desktop and it worked fine, at least for some academic work.
7 months ago

Mina Asj wrote:
I'm new here pleases don't be too harsh



We are never harsh!  
Start simple.  Try to prompt the user for a string, then print out the characters in the string one by one.  Once you have that working, you can try to add a comparison in the loop.

Mina Asj wrote:
also how would you solve this with a while loop and for-range?



Once you get the first task done, you'll understand a little more about looping and testing.  Then you can consider how to do it with other loop types.  
While loops are documented here
For loops are documented here

If you have further questions, don't hesitate to ask.  We are happy to help, but we want you to do the work so you can learn.
7 months ago

Simon McNamara wrote:GNURadio simply requires PyQt4 (I received the same error). I would not be surprised if GNURadio requires the older module PyQt4.



Keep in mind that I don't know gnuradio from a hole in the ground but this seems to indicate that gnuradio depends on PyQt5

Simon McNamara wrote:
How would I find the correct path for python3? The path to python2.7 seems totally different (e.g., something like /usr/lib/python2.7).



The *nix command is "which".  On my Mac:


My Raspberry Pi's aren't plugged in just now, but those are the same paths as on the Linux Mint computer I have hooked up to my TV.  It's based on Debian as is Raspbian (if that's what you are using on your Pi).
7 months ago

Simon McNamara wrote:

For the life of me I cannot get my PyQt4 problem resolved.


According to this, PyQt4 is no longer actively developed or supported.  I wonder if PyQt5 would play better with Catalina.


Simon McNamara wrote:
The shipped version of python for MacOS is 2.7.x .



I have a two-week old install of Catalina and I have Python 3.7.3 as well as 2.7.16.  Open an terminal and enter "python3".  If you haven't installed it, it will prompt you to install the Command Line Developer Tools, which includes Python 3.
7 months ago

Simon McNamara wrote:
This java compiles and runs fine, but doesn't launch the python. No exceptions. No nothing.



If the problem is with the Python script, as it appears to be, you would not get an exception on the Java side.  Errors would be written by Python to Standard Out or Standard Err and you would need to read from those streams in order to capture them (and you should read from them.  They are buffers of limited side, and if they get full, your application stops).  
Have a look at this article for some of the pitfalls with using Runtime.exec().
Have you installed PyQt4?  I do not think it is included with the standard Python distribution.
7 months ago
Java uses something called Pass By Value.  This means that when you pass an object to a method, the method receives a copy of the reference to the object, not the original reference to the object in the caller.  Changing the "output" reference in handleRequest does not change the value of "output" where you called it.  What you can do is change the contents of output in handleRequest.  Since the two references point to the same instance of OutputStream, you would get the desired result.  
I think it is a better practice to use a return value rather than to change a method parameter (that's why Java is Pass By Value in the first place).  It is easier to see where changes are taking place in the code and has less of a chance for unintended side effects.
8 months ago
It is declared by the Python Standard Library to return a String: Python Documentation
8 months ago
Why not use both?  I use Python as a prototype language and a sort of "scripting language on steroids" and I use Java for my professional projects (web applications for the most part).  There's plenty of developers using Python as their primary language as well.  
I found this book to be a helpful introduction to Python:
Think Python
8 months ago
Input from the console is a String.  You need to cast those values to int to use them as numbers.
8 months ago
I don't use Netbeans but I don't see an error.  
What I assume is happening is that the program is running through to its completion and the debugger is exiting with the error code 99.
Can you set a breakpoint on the "hello world" line?  That should halt the debugger.  
8 months ago
There are many changes between Struts 2.3 and 2.5.  The details are here.  There is a migration guide here.
I'm not aware of any issues with special characters, but I can't think of any in our applications.  There is a mention of New Locale Aware Conversion Logic in the migration guide which leads me to believe there may have been some internationalization changes.  We would need some more information to properly diagnose your issue, however.
8 months ago