John ortega

Ranch Hand
+ Follow
since Jan 22, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John ortega

so im currently trying to develop an android app that takes pics of trees and marks them on a map in the users location. im having 1 problem with my locations. Every time i boot up the app it shows a location i have never been to. infact everytime i start the app it shows me at the rose bowl , which i have never been to lol. somtimes it will also show me at my house when im at school. i have no idea how to correct this. if i hit the my location button it finds my current location and everything works fine. its just that initial load were it loads some random location for me. my code for the location is below. id like it to initially load my current location when the app boots up, is this possible?

4 years ago
im trying to print the contents of my checkbox list. Id like to display all the uncheck (false values) and checked (true values) in the order that it appears in the list view. so far i can only get the true values, how can i get the unchecked false values?



4 years ago

Tim Moores wrote:Seeing the full error message and stack trace would help.

Is the missing starting square bracket just a copy/paste mistake?


my question is more along the lines of how to do it , the code for the parsing i linked was just a failed attempt lol. im pretty sure its all wrong. i was hoping maybe somone has a more clear example or method for doin the parsing. I just started using android studio and im not sure how to find the errors , but i think this is it

01-19 05:45:50.803 1831-1831/com.example.romsm.lap E/ViewRootImpl: sendUserActionEvent() mView == null
01-19 05:45:51.103 1831-1867/com.example.romsm.lap D/mycode: species status 200
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: org.json.JSONException: Value [{"id":1,"type":1,"scientific_name":"Platanus racemosa","description":"typically in river areas, but planted all throughout L.A","name":"California Sycamore"},{"id":2,"type":1,"scientific_name":"Pyrus kawakamii","description":"native to Asia, commonly planted in L.A","name":"Ornamental Pear"},{"id":3,"type":1,"scientific_name":"Liquidambar styraciflua","description":"native to SE U.S, planted all around L.A","name":"American Sweetgum"},{"id":4,"type":2,"scientific_name":"Setophaga coronata","description":"native bird, spends the winter in L.A before migrating north during the summer to breed","name":"Yellow-rumped Warbler"},{"id":5,"type":2,"scientific_name":"Calypte anna","description":"native bird, does not migrate. Spends the year in L.A","name":"Anna's Hummingbird"},{"id":6,"type":2,"scientific_name":"Regulus calendula","description":"native bird, spends the winter in L.A before migrating north during the summer to breed","name":"Ruby-crowned Kinglet"}] of type org.json.JSONArray cannot be converted to JSONObject
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at org.json.JSONObject.<init>(JSONObject.java:158)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at org.json.JSONObject.<init>(JSONObject.java:171)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at com.example.romsm.lap.SpeciesJson.makeSpeciesList(SpeciesJson.java:32)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at com.example.romsm.lap.TreeSpeciesListActivity.getSpeciesList(TreeSpeciesListActivity.java:83)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at com.example.romsm.lap.TreeSpeciesListActivity.access$000(TreeSpeciesListActivity.java:26)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at com.example.romsm.lap.TreeSpeciesListActivity$GetSpeciesListTask.doInBackground(TreeSpeciesListActivity.java:49)
01-19 05:45:51.113 1831-1867/com.example.romsm.lap W/System.err: at com.example.romsm.lap.TreeSpeciesListActivity$GetSpeciesListTask.doInBackground(TreeSpeciesListActivity.java:46)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:234)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
01-19 05:45:51.123 1831-1867/com.example.romsm.lap W/System.err: at java.lang.Thread.run(Thread.java:841)

line 32 is
line 26 is , which is weird. it from my main activity public class TreeSpeciesListActivity extends AppCompatActivity {



also were is the missing square backet? i dont see it
4 years ago
hello , ive been at my wits end with this. I cant for the life of figure out how to parse a json. Ive been at this for 2 days looking at online tutorials and vdieos but theyve all just confused me even more. My app is supposed to pull a token from heroku and im supposed to take this data and display it into a view. now ive already connected to the rest api and recieved the token. So i do have the data , i just dont know how to parse it so i can display it in a list view.

so here is were i connect to the api and take out the data. this is just a snippet of the code that shows only the part were i get the info . this part works and i successfully obtain the data i need.


i tried to follow a tutorial and use this to parse it , but i get an error that says it cannot parse this info



i must have went through 12 hour of trying to get it to work lol , hopefully somone can help me understand how to do this.

this is the json data im working with
{
"id": 1,
"scientific_name": "Platanus racemosa",
"name": "California Sycamore",
"description": "typically in river areas, but planted all throughout L.A",
"type": 1
},
{
"id": 2,
"scientific_name": "Pyrus kawakamii",
"name": "Ornamental Pear",
"description": "native to Asia, commonly planted in L.A",
"type": 1
},
{
"id": 3,
"scientific_name": "Liquidambar styraciflua",
"name": "American Sweetgum",
"description": "native to SE U.S, planted all around L.A",
"type": 1
},
{
"id": 4,
"scientific_name": "Setophaga coronata",
"name": "Yellow-rumped Warbler",
"description": "native bird, spends the winter in L.A before migrating north during the summer to breed",
"type": 2
},
{
"id": 5,
"scientific_name": "Calypte anna",
"name": "Anna's Hummingbird",
"description": "native bird, does not migrate. Spends the year in L.A",
"type": 2
},
{
"id": 6,
"scientific_name": "Regulus calendula",
"name": "Ruby-crowned Kinglet",
"description": "native bird, spends the winter in L.A before migrating north during the summer to breed",
"type": 2
}
]
4 years ago

Dave Tolls wrote:You are already checking for whether the User is logged in, so that covers part 1 (if the User is logged in).

Your NoteDetails should be expecting a parameter (noteId).
So that's part 2. Get that parameter from the request. If it doesn't exist (or is not an int) then redirect to MyNotes.
Part 3 is actually getting the Note that's been requested.

Get part 2 sorted and you can move onto part 3.



alright heres what ive done . i used a hidden form field in my jsp , were i have the tabe of link. saved the id to noteid. now im trying to get that formfield noteid , in my notesdetails controller so i can use it for my query and finally be done lol . but i cant get the noteid that i saved in the hidden form. i tried int id = Integer.parseInt(request.getParameter("noteid")); but it comes up as null. how can i access the hidden for field data?

this is my jsp that has the table of links of titles, unless ive misused the hidden form field to save the note id. it should be right


here the controller for my notedetails.im trying to get the noteid i saved from the hidden form field in my jsp
5 years ago
hello , im currently trying to finish an assignment and im totally at my witts end lol. the servlet is a note taking servlet that connects to a database (using mvc). so far my application , connects to the database and saves the data to the scope. and ive displayed the titles of the notes on my jsp in a table. now imworking on the part of my application that displays the notes. you click on the titles of thenotes and it leads you to notes details page that displays the actual note. but these instructions have me confused


If the User is logged in, your controller should expect a noteId parameter. For example:
EditNote?noteId=12345
If the noteId parameter is not present, or if it is not an integer, simply redirect the User back to the MyNotes page.
If the noteId parameter value is valid, your controller is to query your database and retrieve the details of the note with the corresponding ID.

If your controller successfully retrieves the note data, it should:
- Package the note into a model and add the model to the request object.
- Forward both request and response objects to the EditNote View.

im not sure how to do this , or even start it and its left me really confused on how to continue.


this is my notedetails controller



this is the MyNotes controller, which is the begining of my project, that i got to work. and i figured this would probably work for the note display part , so its the same thing.

5 years ago

Bear Bibeault wrote:OK, I'll copy this to the IDEs forum. Running a web app from an IDE is its own ball of wax.



aaah sorry about that. thank you
5 years ago

Bear Bibeault wrote:How are you running the servlets? Through an IDE?




im using eclipse and running them on apache
5 years ago

Bear Bibeault wrote:Where are you putting your .class files?






cs320\workspace\cs320stu38\build\classes\cs320\Homework1\Login

cs320\workspace\cs320stu38\build\classes\cs320\Homework2\MyNotes
i think thats what you asked lol
5 years ago
alright so here are my 2 servlets. my login page is suppossed to redirect to the mynotes page after a successsful login. I use useresponse.sendRedirect("/Homework2/MyNotes"); in my login page at the bottom to try and accomplish that , but it doesnt work. my guess was because these belong to 2 different packages. which is homework1 and homework2. so my question is how can I map it so that my login page directs the user to the mynotes page? If i put Mynotes in my homework1 package , it works perfectly , so It has to be because its 2 different packages. but i have no idea how to make it work.

also , the error i get is HTTP Status 404 - /cs320stu38/Homework1/MyNotes

which means its still sending to the homework1 package , how can i change it so that its the homework2 package?



5 years ago

Paul Clapham wrote:

John nava wrote:also , im thinking that the example should go like this

An example: if b = 4/5, then you should calculate f(1/2)+f(1/3)+f(2/3)+f(1/4)+f(2/4)+ f(3/4)+f(1/5)+f(2/5)+ f(3/5)+f(4/5)



Yeah, that's probably a good place to start from. My first try would be to split that into f(1/5)+f(2/5)+ f(3/5)+f(4/5), which are the addends which have d-sub-k = d-sub-b -- and f(1/2)+f(1/3)+f(2/3)+f(1/4)+f(2/4)+ f(3/4), which are the rest. The first part is a different recursive function, and the second is the same as the original summation only with d-sub-b reduced by 1 (the original was 5, but now you've reduced it to 4). I have to say I'm dubious that this process will work correctly though, I have the nagging feeling it's going to miss something. But it's a start anyway.



yeah the slides that im goin by that i found have an updated version of this question,



i feel like this is gion way above me , im totally lost on what to do. i thought it would be easy to just plug in rationals into the sum of ints example i i found,, but apparently its muc more complex
6 years ago
yeah i understand capital sigma lol . darn , i thought i could go buy the sum of ints example i found online and thats the way i was goin about it. i guess that was wrong , how else can i go about this? im just starting with scala so im pretty much limited right now with what i could do lol
6 years ago

Paul Clapham wrote:Well, putting aside my griping about the details, what you need to do first is to write that summation in terms of some function of d-sub-b plus the same summation applied to d-sub-b-minus-1. The first part might also be a summation, and the termination condition of the second part happens when d-sub-b is 1.

I just spent a minute trying to do that, and I have to say that it looks a lot more difficult than division (although I haven't tried the functional programming version of division of fractions so I could be wrong). Anyway so far what you have doesn't look helpful to me, but I think that's because you started programming before you knew what your program should be doing. So slow down and figure out what needs to be done first, before you start typing any code.



yup your right, i had it in my head that this was a summation problem. but its looking like its something way different. I gotta try and understand what the heck this question is asking lol. also , im thinking that the example should go like this

An example: if b = 4/5, then you should calculate f(1/2)+f(1/3)+(f(2/3)+f(1/4)+f(2/4)+ f(3/4)+f(1/5)+f(2/5)+ f(3/5)+f(4/5)

is this a sum of rational numbers? im trying to figure out what it is the question is asking
6 years ago

Paul Clapham wrote:I'm lost too, because I don't understand the instructions. Nothing in the definition of the function says anything about the possible values of n-sub-k. So I don't see why f(1/3) and f(1/4) and f(2/5) and so on aren't part of the sum to be calculated. Perhaps something elsewhere in the book talks about that?



that is literally all it says lol , the question right above it asked to implement the divide function for rationals, which i did.
6 years ago
alright , so im trying to do this example in a book i found online. but im a little bit lost. heres a scan o f the problem



now , im still learning scala, but i went with what i have below , which doesnt work




and i already made my function > for the comparison. and the rational class. everything works ,so i just included the sum part only
6 years ago