How can I make my java program retrieve data sets online? - java

Currently I am working on a program that will assist me for making decisions when trying to bet on sports. My goal is for the program is that each day I would like to retrieve things like weather, past games, player/team stats etc. then aggregate it all so that I can see which teams make the most sense to bet on.
I'm not exactly sure if it's even possible to do on IntelliJ, the text editor I'm using, because I do not think its connected to the internet on its own. I think one approach would be to use a separate program (not IntelliJ) to automatically go to each website and copy the appropriate information into an excel document; then I could copy the file into my project each day before I run it. Something like that is what I have in mind, but I would appreciate some help if anyone knows which strategy I could use to move past this obstacle.
I've recently learned how to and created a GUI to navigate my program a little easier than through the console; therefore, my work ethic is not an barrier in this instance. I've taken one programming class in college and would consider myself an apprentice (one step above a novice).

You can use jsoup for scraping data from a website, Then you can use Apache POI to add it to an excel file.
Heres the website https://jsoup.org/
Heres a good tutorial about apache POI https://www.baeldung.com/java-microsoft-excel

Related

Is there a tool/API to extract Minecraft recipes?

A friend and I decided to code a discord bot in Java, using JDA. The idea is for the bot to give you a request Minecraft recipe (a picture of it). However, we don't want to have to download every single recipe (there are way too many of them). So I was wondering if there's something we can use that would give us the recipes with pictures and everything, like an API or a website that we can access from the Java code that would return something we can use. (No code attached since we haven't really done anything and it would serve no purpose).
I am not sure if an API exists that can do that for you. If the problem is spending the time to download every single recipe I might recommend creating a webscraper that could get that data from you. Getting the images from a site like https://www.minecraftcrafting.info/ would be fairly straight forward using python and beautifulsoup (https://pypi.org/project/beautifulsoup4/). Hope that helps and good luck!

Connecting to API

I plan to build a simple website that takes data from a websites API and puts it into charts that are listed on my website. Here is what I am trying to do:
Take data from the API listed on localbitcoins.com
https://localbitcoins.com/api-docs/
Code a program that parses this data as I see fit.
Create a graphical layout that displays the data.
Post the graphs on a website that I have created, ideally to update in real-time.
I don't know where to begin.
I am not asking for some one to hold my hand through it all, but more so to give me some pointers on where to start, what resources are there that I can look at, and so on.
My instinct tells that that I need to tackle API and coding part first. Can someone point me to a resource that could take me through this? Should I stick with Java or should I use another language for this?

Copying all the DATA from SD card/USB pendrive

I've been learning Java for a month now. I've already managed to code some very simple stuff like prime number generator and a simple calculator. Now i'd love to try working on something more complex.
Here's my idea - I'd love to make a program that can copy pictures from SD card or USB with a single click (something that my parents can use very easily to copy all their photos to a folder without my help)
I was brainstorming quite a bit about it and before i start i want to ask following questions:
1. Are there any inbuilt Java methods that can help me with the following task?
2. What are the other (non-beginner) Java features that i'd need to read about?
I want to start it from the scratch, make it simple at first and progressively add more features to practice and learn some more.
Any pointers or tips much appreciated.
I'd suggest doing this as a script. The script can invoke java if you'd like to improve your java skills. However, scripting languages can also copy/move files very easily. If you choose java, read about file I/O, reading files, writing files, etc.
Here's a link for windows. Not sure what your operating system is, but you could create an executable script on mac, linux, etc.
http://www.wikihow.com/Write-a-Batch-File

Do I need a database for my game?

I will develop a game in java which is about chemistry experiments that include quizzes and lessons . I need to store only two things in my game which is
Score of the quiz
the experiments that the user finished in order to put some sign or change color or whatever to indicate that this one you have already finished it in the experiments menu
Do I need a database ? I read about XML and it used to store simple things . But as I far as I know that XML work with web and my game is offline, how am I going to use it in my case ?
Also , someone told that I can use simple text-based format . But how ?
If you're not planning on making the game online, then you don't 'need' to use a database. You can use an XML (which can be used offline as well as online), or you can use SQLite.
On the text based format thing, it might seem easier to use, but it will cause you trouble on the long run. My suggestion would be to go with XML.
You can learn about XML here as well as how to parse them.
XML should work fine and would probably be my approach to this problem. It's not tied specifically to the web. It's an extensible format for data that has many existing libraries in many different languages including java.
You also have other options like CSV files.
You can use a file-based local database like SQLite but it sounds like overkill for what you've described.

Exporting Access Tables Programmatically

alright, after a few hours of searching and reading all over the net, I have broken down and decided to ask for help. I am working to automate many of the more medial and repetitive tasks as work, and stumbled upon AutoIt, I love the tool. anyway, Today's task is the export of a slew of tables and queries from Access 2007 in a few different formats. mostly CSVs some Tab delimited, and a couple of dBase DBFs and DBTs. now none of this is all that difficult and in fact the person who previously held my position created about a hundred Macros in the mdb that export the tables. seems to me that he fell well short of hastening the process as you still have to run each macro. I am looking to create an autoit script that will export the correct tables in the correct format to the correct place with the correct name. doesn't seem like it should be that difficult.
so thus far I have been imagining using ADO to tell Access to export which table in which format and where. but I cannot seem to find the necessary commands needed to do that. I also figured that perhaps, at least with the text based formats (CSV, txt, tab) I could read each record out of a given table or query and then build the text file myself in autoit, not the simplest way of doing it, but it could work. The problem arises when trying to create the dBase file, I haven't a clue where to begin with that.
I am open to using JAVA, AutoIt, PHP, or Perl to accomplish my task.
I should note that I am fairly new to ADO. the syntax in ADO seems to elude me frequently. so, any and all help is appreciated, please refrain from the "Just google it" responses. if you have a link to share, or a resource that you have found helpful please post that as well, I am not allergic to reading or doing research. Sometimes it just makes more sense to ask for help.
Thanks,
Kyle
If you are open to using VBA, you could probably make it work with only a little code and the DoCmd-Object.
To export as CSV, have a look at DoCmd.Transfertext
To export to dBase, have a look at DoCmd.TransferDatabase
If you have questions about using those, just ask in the comments and I will provide more information.
This is a sort of bonkers idea, but if you already know Java, you may be able to get this to work with the JDBC-ODBC bridge. You'll first have to register your particular Access database as a named ODBC data source, as the bridge does not appear to support on-the-fly ODBC. I don't have a Windows machine on hand and don't remember the exact sequence of steps to do that, but it should be available from the ODBC driver manager.

Categories

Resources