Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks.
On April 15 2015 13:41 FFGenerations wrote: ok well i've given up trying to make it work this way for now. i sort of understand what you've been saying earlier about the autogenerated thing being fucked up. what you wrote totally flew over my head before, but you kept railing on about it until i started to understand. thanks all, you've been brilliant!
will move on to trying to parse it myself instead
Good that you're moving in the right direction .
Just a couple things so you don't get overly dissuaded. There's nothing inherently wrong with using auto-generated code, and in fact a lot of major frameworks will have you relying a bit on them (C# with ADO.NET comes to mind). The important thing is to understand why you're using an auto-generator, and how actually interact with it.
Overriding ToString() methods is also a valid option in many cases, and returning the main identifier for an object like a Name is definitely a good time to do it. Of course, in this circumstance it would be a band-aid solution, because inevitably you'll want other information from you objects, and you'll be right back to the same problem you started with.
Finally, parsing text may seem like a massive undertaking at first, but it's something you will be dealing with eventually if you're a programmer of any kind, so it's definitely something worthwhile to learn. Luckily for you, you're dealing with XML, which is basically designed to be parsed easily.
i done the basic one first which also shows it being done with Lists then was wondering why the fuck my nested xml wasnt working and then found the person had just uploaded this one, thank god
so ..... the next thing i'm going to find out is how "deep" into the xml file i need to go to get the data i want i guess, or how far i can simplify it before it fucks up on me. i tend to lean towards it being easy now but i might end up having to look at a plugin that jumps to the parts i want, or something, which would be annoying :D since i have 5 days left lol
<ann> <anime> (use @XmlValue here maybe to grab 'anime id' and 'anime name'? need to check what it does exactly) <info></info> <info></info> (how to deal with multiple infos? maybe @XmlValue will straight up work here too to grab 'info src'. or maybe the parser will return a List of infos in this case) ..... </anime </ann>
Why is the name of the variable Anime? Do you even need this field? Each Anime having a list of "Info" (whatever that means) seems pretty stupid in the first place. If you need more fields you can create them and call them things that actually make sense. You'd want to add fields for say release date or author rather than creating a list of Info.
I really dislike the idea of this Info class, but if it works then I won't rain on your parade.
so i'm currently saving everything in an info tag into an Info object
@XmlRootElement (name="info") public class Info {
private String src;
@XmlAttribute(name="src") public String getSrc() { return src; }
and taking the @XmlAttribute from each info entry (if it exists) (only 1 exists per anime and i only need the 1, so that's handy) and accessing it with info.getSrc
right now i'm getting....
which is basically "HOLY FUCK I DONE IT AND SO FAST LOL OMFG TNX TUTORIAL also tnx brain and planning on paper lol"
btw is it normal for netbeans to ramp up to 1,300,000 memory lol
what i would delete that shit but it probably goes all red
i'm going to use the data to populate a webpage frontend for the user and also save it to a local database or do something else with it
i guess my next task is to go figure out the API get request so it doesn't look like a complete hackjob
i have a sort of interesting question .... how would i describe what this is doing in non-retard terms? for example i am trying to describe it like:
"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....
silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"
Then you should be parsing the type field in the info tags, and then pass the value into a variable in the Anime class. Basically, your class should look something like this:
class Anime{ private string title; private string altTitle; private string genre; private List<string> themes; //assuming >1 theme is possible, otherwise just a single string private double runTime; }
"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....
silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"
Well you didn't actually end up using inheritance so that would just be a lie. We thought you needed inheritance because you had Anime and Manga classes before, but the Manga class disappeared so you don't need/aren't using inheritance.
The application services client anime requests by acquiring the information from <webservice> and displaying them in a user friendly manner. How this works under the hood is irrelevant unless that is what you're supposed to be describing.
look at @XmlRootElement (name="info") look at @XmlAttribute(name="src") save this
if there is an xml parser functionality that lets me check for Picture inside Infos then take the corresponding SRC from that Info and put it straight into Anime then sure....but i don't know if @XmlAttribute or @Something exists to do that
if anything there might be a plugin that lets you do that, like it autoscans the document and returns X for your nomatter where X is located...........
there is no fucking way i'm getting into that though :D i've got 4 days to finish this and then 4 days to do 2 other major assignments . edit: unless there is @functionality that just does that.............
"custom parser that unmarshalls desired data from my sample nested xml file into objects with inheritance " <- this last bit, how should it be described? i want to indicate that the classes are connected and also use Lists as attributes.....
silly question but maybe you wanna answer it . i'm really bad at using terminology . i guess i could phrase it "custom parser that unmarshalls desired data from my sample nexted xml file into objects using inheritance and lists as attributes"
Well you didn't actually end up using inheritance so that would just be a lie. We thought you needed inheritance because you had Anime and Manga classes before, but the Manga class disappeared so you don't need/aren't using inheritance.
The application services client anime requests by acquiring the information from <webservice> and displaying them in a user friendly manner. How this works under the hood is irrelevant unless that is what you're supposed to be describing.
i was just describing the "prototype version" for when i have to write about it and sound mildly technical or whatever
Well, can't help you with the specifics because I haven't used JAXB before. That said, this is the part where you learn that your power to Google is what makes you a programmer :D.
So a couple of my friends and I want to make an IOS game. Currently we're writing the code in Java and then we're gonna import it into IOS. My question is is this a good idea, and if so, do you have any tricks and stuff to make the import easier, since there are probably gonna be like a million things going wrong once we do it. Also, i've been poking around for engines, and 5 mins of google got me to the Unreal engine, which seems pretty OK. Any engine suggestions for IOS games, and tips/tutorials on how to use them?
so apparently you don't need to use REST web services, you can just have
URL url = new URL( "http://cdn.animenewsnetwork.com/encyclopedia/api.xml?title=~neon genesis" );
Ann ann = (Ann) ums.unmarshal(url);
and it does the get request and puts it straight into your parser. wtf. that is insane i just shaved like 40 years off my life
i think i move on to figuring out how to make it into MVC now with a basic web frontend and then add a database functionality and then add jquery stuff
question about what i do next:
am i supposed to have the anime classes as managed java beans or can i keep them as they are and just print the data to a jsp page via a servlet controller?
ive been fucking around for a while and ended up with an insane mess and getting no error but it just fails to run with no error specification . at one point i tried to add bean annotations ontop of the xml annotations but it gave me a frowny face and i backed off for the time being
this is what i've got in my head so far: 1) jsp frontend page that takes the user's search string in a form 2) servlet page that takes this and passes it to my service class 3) the service class does GET request and parses the response into the anime objects 4) but then how do i access this data ? does it need to be turned into a java managed bean? can i access it directly from the jsp page? does it need to go through the servlet controller?
ill come back in 8 hours or whatever after i slept
have been trying random stuff but there's tons of stuff to try and that's before i even go to one of the super heavy tutorials .
edit: maybe i make session facade bean from the Ann java class and then use that to do stuff. if it lets me annotate it
OK here is what i've got so far. it runs , time-outs for about 9 seconds, then displays the HTML ("end") ie it doesnt display the object data
when i remove the line AnnJAXB.Unmarshalling("evangelion"); it runs and displays the html instantly, so that bit there is causing it to time out and return nothing from it.
i tried changing AnnJAXB Unmarshall to return an Ann instead of being static void method. i managed to get it to work eventually but its still hanging like previous version then not displaying the object data.
OK so the animenewsnetwork is online again now so I can finally test what I was doing all that time. It loads without timing out but nothing in the For loop , neither the html nor the Ann attributes, are displayed.
On April 17 2015 07:38 FFGenerations wrote: OK so the animenewsnetwork is online again now so I can finally test what I was doing all that time. It loads without timing out but nothing in the For loop , neither the html nor the Ann attributes, are displayed.
If you could have a glimpse that would be awesome :/
I just woke up so gonna take another look in a min
Are those your only 3 classes in SO. It's kind of hard to troubleshoot code without being able to run it. Did someone already talk to you about possibly putting your stuff on github or something if you want more help?
Edit: Definitely not your only 3 classes. See question above