How can I retrieve database data and present it in an application - java

I am currently working on an application in android studio as I am trying to learn how to use it in my spare time, my knowledge is very low so I was hoping I can explain the concept of my app and ask people for some pointers in different techniques I could use. The basic idea of my app is that it works by allowing people to search for a celebrity and it shows a few facts about them, their date of birth etc. I know its nothing special but it is literally a concept to help me improve my android studio knowledge.
My main issue with this is getting the information from the database into the application in an easy to read and presentable way, what sort of things should I be researching to help me achieve this, from my knowledge I believe I would need to set up a scanner to take the users input, then search the database to find the information and then I need to find a way to return the results in a presentable manner.
Apologies if this is too long winded a question, and thank you to everybody who takes the time to read and respond to me.

If you are looking for some API then check this out this can be help full.
https://api-ninjas.com/api/celebrity
You can even check if Wikipedia have any API for providing info.
I found this also
http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#APIs%5Ffor%5Fbots
It appears there's also an API for IMDB: http://www.deanclatworthy.com/imdb/

Related

Best practices when learning a new API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
When learning/working with a new API, does anyone have any tips for effectively learning it?
I currently make a bunch of get requests to understand what I can and cannot retrieve based on the API's responses. From that point I try to map out what is within the API and see what I can build out.
If you guys could share anything what you do that would be great.
The first thing i do is to read API documentation and search for examples in it. As you get used to read this kind of docs you'll find easier to find exactly what parts of the functionality you need to learn first.
I also use search engines to look for more working examples, and after that I work on creating a minimal use case of the API (for example write a file with commons-io api of apache). For this is a good idea to create a project with multiple JUnit tests with minimal use cases of an API (in the example of commons-io create a file, delete a file, move a file, copy a file, ...).
I must say this is not a science and each API is a new world and may require a slightly differnt approach (As with rest apis you'll need to use some tool like curl or postman to understand how to communicate with them, others will have pre-requirements like have a working installation of a system, and so on).
As everything in coding you'll need to do it by yourself and struggle to solve issues you'll find by yourself (what can take several hours of your free time).
There is no "magic" behind learning something, and coding is in some way like playing a musical instrument, it requires practice.
I dont know whether you are a beginner or you have developed already but will start from scratch..!!
Apis are the code which will allow you to play with the content having certain formats...!!
There are apis based on what operations you want to do are.
Get=> In order to fetch something.
Post=> In order to save something.
Put => to update something.
Delete => to delete something.
People also use patch similar to update...!!
You can play around all these by constructing objects and databases...!!
You will require rest services spring restful web service is the ultimate good options..!!
Diving deeper you need to be careful assigning the names you give I mean the meaningful names as you dont know if tomorrow you become famous and need to make your apis sharable ;)
Now some common concerns are like
Meaningful Name.
Versioning is required like what the old apis are working and now what data your apis give.
Can implement swagger its a tool which will allow you to describe the apis like you can write what this api does what type of data it brings etc etc..!!
Apis are more or less called an end points means you have that link as a connection between front end and backend So need to keep it secure..!! By authentication.
Above four points are considered to be good practises for writing apis ;)

Libgdx Quiz- Using SQLite Database?

I have been learning Android development and using the Libgdx framework for over a month now and want to create a test app. The app i want to create is a quiz and im stuck on the situation on how i am going to store all the questions, answers.
Being a web developer for many years i of course thought of a database but libgdx doesn't have much support for sqlite which leaves me stuck on how to achieve the storing without using a database.
Does anyway know any way to use sqlite with libgdx or how i can achieve this another way, i would appreciate the help, thank you.
I would not go with SQLite in this case. Since it is just a test app and you probably won't have millions of questions and won't need to do any kind of querying, I'd suggest you to use JSON to store your questions.
The JSON support of LibGDX is pretty good and it works on all platforms as well. Have a look at the wiki to see some examples of how to use it.
Furthermore it means that you can easily edit your questions, since it is a human readable file format.

Am I slow or is it normal for all projects to take so long and longer than expected? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am new to this. I have been learning java for a few months and I am working on my first project, myself.
What confuses me is that I write a few lines, run it, sometimes it works, a lot of times it doesnt. Then I have to google it, find a solution, incorporate it. Then I try to write more code, sometimes it works and often I have to repeat the whole process , or ask here at stackoverflow.
Now probably because i am new , with practice I won't need to look up things as often, HOWEVER, as my skills get better, the projects I take on will get harder as well,so I am guessing that I will STILL have to keep looking things up. Like I learnt how to send data over TCP/IP, then I had to look up how to encrypt it, then how to encrypt with strong encryption, then store that data in a derby datase , each time I have to continually look things up.
So the question:
Part 1:Does this process ever end? Surely it must, otherwise how do software projects get finished. Programmers couldn't be looking things up all the time? Do I just need loads and loads of coding hours?
Part 2:It always seems to take longer than I anticipate. If I am using the GUI editor to design a form and think I can do it in two days ( as an example) something ALWAYS goes wrong and it takes 2-3 times as long. If I am so lousy, I won't even be able to hold a job, I'd be fired in 3 days :(
Any help from experienced people greatly appreciated.thanks
Le Prince De Dhump
As you get more experienced, you will have to look things up less and less. However, I can tell you that you will never stop looking things up altogether. I've been using Java for about 8 years now and still use Google to look up code snippets and answers to questions all the time. There's no shame in it, it's just part of being a programmer.
Part1: I write programs for about 25 jars and still use google or search in books to find solutions [Its often faster than come up with something new of your own]. More practice and better knowledge of the libraries, data structures and algorithms reduce the amount of searching on the web.
Part2: It is a common problem in software development to underestimate the time needed for the implementation. You need a lot of practice and review what was the reason it took longer than expected. It seams that software developers tend to blank out all the little problems that will eat so much time while implementation.
My advice: Split your problem in little peaces and estimate the needed time separately. If possible compare the problems to one you have solved in the past and remember how many time they took. And at the end of the project review which estimations where totally wrong and try to figure out what was the reason. That helps for future estimations.
Out there are so many books which try to help you to solve the time estimation problem. Reading some of them may also give clues what the pitfalls are.
I think it is a more general issue regarding with the concept of skill acquisition (so perhaps more suitable for "the workplace" site).
There are two good bools about the subject, "Mastery" by Robert Greene and "Outliers" by Malcolm Gladwell, about this subject and the 10,000 hours necessary needed to acquire a disciple.
A short answer: this is the normal: these things that you are doing have not yet been "wired" to your brain and that takes time and attempts. After some time doing those tasks, you will be able to "remember" faster, or do them on subconsciously. Additionally you will be able to build associations, so that your mind will be able to recognise more patterns (or differences) etc. Each thing that gets "in" your head will be accomplished with less effort therefore you will be able to think deeper and achieve more at the same time.

How would you test google maps?

I came across this in an java interview earlier. It was one of the only question I wasn't able to answer merely through lack of familiarity with google maps integration.
Can anybody let me know what would have been a model answer? Research from google searches point me to Selenium but I'm not sure if I'm even on the right track?
p.s I'm not sure whether I posted this question in the correct manner but apologies in advance.
Selenium is a fine example. Check out some of their example videos. Selenium is basically a way to test an application without having any access to its innards.
Either way, I'm sure there would be a follow up question with more specifics, so play around with it to get a feel for what it does.

How to deal with inept management [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
A project I was working on has finished, so I've been moved on to some new tasking at my employer. The previous work was very agile, small team, progress over procedure, etc etc.
So anyway, the new project I'm on - I find myself confused on how to deal with management. They have no real understanding of object oriented programing , current technologies or methodologies. They seem to fear change and just recently we moved to the latest JRE
We do these code reviews and I have to listen to "gray beards" saying how much better it is in ADA or how they used to do things in C. But then when they try to code review - they lack even the most basic understanding of OOP design and dev. They focus more on the style of the code; spacing; method names; etc.
One of the senior level people say we should be writing our own logger instead of using log4j because of one negative review of log4j in an academic PDF written ages ago.
How do I deal with this? How can I explain to them that their design is faulty or that they are really behind the times, without coming across as a jerk. I've only been with this organization for about a year - so I don't know how much credibility I will have.
Regarding the code review, I would say make them happy. Name and space things the way they like. Focus your time on better design, of course, and enjoy the ADA reminiscing, it still can give you some background of where things are today and how they got there.
In other words, don't take that part too seriously. Worry about what is important to getting the job done. The job in this case is making those that matter feel you made a positive contribution to the project.
Regarding Log4j, I would just suggest a different framework. Either the built in JDK logging (can't complain about that, it is a built in API) or something like SLF, which lets you plug in whatever you want (including your own, I guess, which you can then throw away and replace with something real when they realize it was a mistake, and you only have to change the classpath).
Now there will be times where it is important. In that case, make it sound as much as possible that it is their idea. For example, on the logging, state that there are many logging frameworks out there that represent a lot of lines of code, and you were wondering if there are other ways to leverage that work for this project, and then let them "figure out" the solution.
There will be times when you have to push something as your idea - there will be no other way. In that case stick to the evidence, martial allies as much as possible by keeping relationships with those that do have influence in good standing, and realize that every battle you fight, you lose position, even if you win (perhaps especially if you win).
I'd recommend approaching your concerns as 'suggestions'. Make a suggestion and ask for their opinion on it, that way they feel as if they are still in control even though you've planted the seed and are directing the conversation.
Regardless of how long you have been with an organization, you are there and you are there for a reason (they hired you for your input). Find your voice and how to best approach your team members with suggestions and/or concerns. This is a crucial part of being a team member and will increase your value.
Get a good formatter and create you method names this which they cannot complain about then your discussion can move onto real issues.
Some people cannot get over these little details during reviews, so you need to make it a non-issue.
Your work has to gain credibility before they will listen to you. So yes, do as others have recommended, and make sure the unimportant formatting laws are adhered to. But also do such high quality work that they can't ignore or marginalize you. Try to guide them in ways that makes them think the ideas are coming from them.
I disagree with the recommendation of another logging framework besides log4j. Citing an old review, without any kind of personal experience, should not win the day here.
However, there might be a way to turn this to your advantage. If you agree and recommend the logging built into the JDK or Apache Commons logging, you'll find that both are quite similar and can actually use log4j as their underlying implementation.
If your adversary isn't paying much attention, you may win points for giving in and avoiding a bike shed argument and STILL get what you want.
Respect your elders I say! :)
Really though, just remember that a lot of these gray beards were probably programming while you were in diapers. That doesn't make them experts in the latest technologies, but it should at least earn your respect. And sometimes if you can find a way to look past all the hemming and hawing and "back in my day" stuff, you can pick up some pearls of wisdom from those old dogs!
Now from the programming perspective, looks like Yishai has it right. It should be pretty easy to conform to the coding styles they want, and once you've made them happy you can run with the code the way you want.
And if you have to present a counter opinion, back it up. If you want to use something like log4j, talk about SPECIFIC projects in your past where you've used it and it worked fine, and offer to help anyone get past any problems they have with it, etc. etc.
Remember, while you look at the old gray beards as not knowing how to do some cool new programming, they probably see you as a young whipper snappers with a lot of crazy ideas out to change the world. An ounce of patience will get you a pound of respect.
I am an old gray beard but I abandonded COBOL 35 years ago and code in dotNET C# and have kept up with the young wippersnappers and try to mentor them too. With that said I see a lot of managers and programmers that are still in the dark ages like VB6 and cannot accept web farms, web services some of these gray beards and young wippersnappers cannot normalize a database table to 3NF let alone code nTier, WCF or have a clue. Worse yet some of the managers are 30 years behind and rely on the VB6 at best and a flat file using Access97.

Categories

Resources