I've been programming in java for a little while and I've found no real way to even come close to this goal. My googling has been pretty fruitless as well.
I'm looking for a way to essentially download current weather (or other but weather is a good start I suppose) and save the current temp / humidity / dewpoint / next day forecast for those numbers into an array of strings
I have no idea where to start, but I figure that this will be a good place to start learning how to use java to fetch.
Thanks!
How would you approach this task in other language?
In the case of weather you would probably look for some API exposed by the site you're trying to get the weather from.
Here come some clues:
1. If you want to just issue an HTTP request, get a result (kind-of ajax style) and parse the web page you can use java.net package or if you want a (much more powerful) thirdparty lib, use Apache HTTP Client.
2. If you're looking for API exposed via WebServices (which I believe is a better approach here) then they're language agnostic, so you just turn to web services (SOAP/Rest) in Java just like in any other language.
I know, the answer is a little bit 'common', so please clarify 'how' are you planning to solve this issue (even in any other language)...
Hope, this helps
A good source for weather information is METAR. There is also a Java library jweather available which should encapsulate all network/protocol/api issues to a limited set of methods to retrieve the required weather information
Related
I am working on IBM RTC and I need to import a .csv file to RTC using JAVA. Is there a way to do this? If yes, can someone help me with the same.
Parsing CSV data is something that you definitely do not want to implement yourself, there are plenty of libraries for that (see here).
RTC offers a wide range of APIs that can be used with, see:
rsjazz.wordpress.com or
jazz.net
In that sense: you can write Java code that reads CSV data, and RTC has a rich API that allows you push "content" into the system.
But a word of warning: I used that java API some years ago to manipulate information within our RTC instance. That was a very painful experience. I found the APIs to be badly documented and extremely hard to use. It took me several days to come to working code that would make just a few small updates to our stories/tasks.
Maybe things have improved since then, but be prepared for, as said ... a painful experience.
EDIT, regarding your comment on "other options":
Well, I dont see them: you want to push data you have in CSV into your RTC instance. So, if you still want to do that, you have to use that means that are available to you! And don't let my words discourage you. A) it was some time back when I did my programming with RTC, so maybe their APIs are better structured and more intuitive today. B) there is some documentation out there (for example here). And I think everybody can register at jazz.net; so when you have further, specific questions, you might find "better" answers there!
All I wanted to say was: I know that other products such as jenkins or sonarqube have great APIs; and you work with that, all nice, easy, fun. You get things working with RTC, too. Just the path there, maybe isnt that nice and easy.
My personal recommendation: start with the RTC part first. Meaning: just try to write a small programm that authenticates against the server; and then push some example data into the system. If that works nicely for you; then spend the time on pulling / transforming the real data that you have in mind!
I've got a client who uses Quickbooks Online for accounts, and he wants to be able to read data from it programmatically. We're using Clojure, so any solution in Java will work, or http gets etc can be made directly if necessary.
They've got what appears to be a nice RESTFUL interface to their stuff, and a java library for accessing it, but I can't make head or tail of their documentation: https://developer.intuit.com/docs?redirectid=accounting, which all seems to be about webapps and OAuth and other stuff.
All I want to be able to do is get, say, a single customer record.
Can anyone point me to the simplest possible Hello World type program, in any language? (Preferably Java or something easy to read like python)
I'd imagine that what I'm looking for would look something like:
import quickbooksapi
username='fluffy'
password='doom'
cus=quickbooksapi.get_customer(username,password,id=4)
print(cus)
or something?
Or have I just got the wrong end of some gigantic stick here?
This looks the best available documentation:
https://developer.intuit.com/hub/blog/2016/04/25/quick-start-to-quickbooks-online-rest-api-with-oauth1-0
It's a recent blog post by a Quickbooks developer, showing how to get Oauth keys and then use curl to access the REST API.
It seems that you have to pretend to make a SaaS app in order to get one bit of gubbins and then there's another thing where you can get the rest of the gubbins.
After that you can use curl, putting all the gubbins in the headers. (The postman extension for chrome that he uses can generate curl commands and equivalents in many other languages)
It works exactly as advertised (6th August 2016).
That's enough. I can take it from there.
I have a project that is built on Applets and that also comprises of Corba calls to backend (which is in C language). Now I need to remove Applets and convert it into JSP and Javascript combination. But the code seems to be complex as it also consist of backend calls. I am facing problem in figuring out what is to be converted in JSP and what in Javascript.
If I convert all the applet logic in Javascript, how will I pass the javascript data to the Java objects to pass it as input for corba calls.
I can't implement all the logic in JSP as the existing logic depends on the dynamic change of data by user.
I tried various links but couldn't find the proper solution to my problem.
I read somewhere that Google Web Toolkit (GWT) might help me converting Java Logic to Javascript, but couldn't figure out what exactly needs to be done for that.
Can anyone guide me how should I start and what exactly should I do to complete my project?
First the bad news. There is no generic and magic solution that can convert your legacy (as you are describing it) into modern n-tiers web application.
I can suggest you the following steps.
decide what kind of client and server side technologies you are going to use and learn them to become familiar enough to start coding.
learn your legacy code and re-design it. Decide which parts of the code must be re-written, what you can use as-is and what you have to change and/or re-package.
To choose client side technology try to search for "client side javascript frameworks" or something like this. Popularity of GWT that you mentioned is going down now. The most modern framework these days are AngularJS.
Concerning server side technologies I personally prefer Spring but you can take a look on Guice and EJB too. You can also implement whole server side as as collection of servlets. It is up to you.
Start learning this amazing world and come back with more concrete questions. Good luck.
I need to extract data from a Java web application. To be specific I am looking to extract real time stock data from yahoo market tracker. Can anyone please suggest any method?
I'm not sure you can extract the data from Yahoo Market Tracker. Even if you can, you might not be allowed to - I can't see any obvious terms & conditions/licensing. I think (although I could be wrong, anyone got better info?) that you'll need to pay to get access to an API providing near realtime market data.
There is a HTTP-based Yahoo Stock Quote API you could use to get prices, described here. Very simple, returns a comma-separated list of attributes for one or more stock symbols, for example:
http://finance.yahoo.com/d/quotes.csv?s=MSFT&f=snd1l1yr
It might not be realtime enough, but it might be the best you can do for free.
You can use glorious HTTP protocol to do that. Use any language you are comfortable with (Java, C#, VB.NET, python, ruby, php) and crawl the website you are trying to get information from.
I need to extract data from a Java web
application
From your standpoint, the fact that it is a Java Webapp or a PHP-one or static html pages doesn't change anything. It is not because Java is backing the webapp that suddenly you get a "Java-way" to extract the info.
Now in some cases there are APIs provided allowing you to interact with the data present on the website: but once again the fact that the Webapp is a Java one or not bears no importance.
I'm writing a Java program, and I want a function that, given a string, returns the number of Google hits a search formed from that query returns. How can I do this? (Bonus points for the same answer but with Bing instead.)
For instance, googleHits("Has anyone really been far even as decided to use even go want to do look more like?") would return 131,000,000. (or however many there are.)
Related: How can I programmatically access the "did you mean" suggestion? (eg searching "teh circuz" returns "did you mean the circus?")
found it: http://code.google.com/apis/ajaxsearch/documentation/#fonje
The Google Terms of Service say this:
5.3 You agree not to access (or attempt to access) any of the Services
by any means other than through the
interface that is provided by Google,
unless you have been specifically
allowed to do so in a separate
agreement with Google. You
specifically agree not to access (or
attempt to access) any of the Services
through any automated means (including
use of scripts or web crawlers) and
shall ensure that you comply with the
instructions set out in any robots.txt
file present on the Services.
Google has ways of making life unpleasant for you / your company if you violate the Terms of Service ...
UPDATE: The second sentence is about the way that you use Google's services ... including their published APIs. It is not entirely clear from the wording what is allowed and what is forbidden; literally speaking "any automated means" is very broad. However a Java app that performed Google searches, screen-scraped the results and repackaged them to provide some value added service would (IMO) be a violation of the TOS. And using Google's published APIs to do the same thing would (IMO) also be a violation.
But that's my opinion, not Google's. And it is the Google opinion that matters. If anyone is thinking of doing something like this, they should contact Google and check that what they are proposing is OK.
The point is that Google is not going to assist people to subvert their search business model. Anyone who thinks they can get away with it based on some clever interpretation of the TOS is going to get burned.
for the first part of the answer, try read the t-o-s; for the "did you mean" part, see: http://norvig.com/spell-correct.html
You may be able to do it "legally" using the Google Java Client Library. I don't know for sure, but they may have some methods similar to what you're looking for, and you won't be violating their TOS.
Google Data APIs Library
You can legally access the Google AJAX Feed API through its RESTful interface:
http://code.google.com/apis/ajaxfeeds/documentation/#fonje
Bing still has a developer program where you can call against their API in a JSON/XML or SOAP matter:
http://www.bing.com/developers