I finally got my app to take a picture! It turns out, I needed to set a permission allowing me to write to the sdcard, and my code to do this was silently failing. That definitely needs to be fixed!
Some limitations of my current implementation are: the app passes a constant filename 'myImage.jpg' to store the file as, but it seems that if this file already exists, it is not overwritten. For the actual app functionality, I don't want the image to save to the storage at all, so this isn't really an issue for me. The other thing is that the camera operation isn't being finished correctly, because it only works once: if you try to press the button again, it says 'HardwareClosed'. At least in this case it doesn't fail silently! I'll have to look more closely at the documentation to figure out what steps I'm missing.
Over the weekend, I also worked through some of the exercises in the Algorithm Design Manual book I'm reading. So far I've read chapter 1, and over the weekend I started to work on the programming exercises at the end of the chapter. It asked me to implement two methods of solving the Traveling Salesman Problem, both of which had flaws.
The first implementation was to start at a point, find its nearest neighbor, find the nearest neighbor of that point, and so on until all the points are visited. If the points are in a line in a certain format, the algorithm computes a path way longer than what is optimal.
The second was to find the shortest distance between points in the whole set, connect those points, and continue this process until all points are connected. This still won't come up with the optimal solution in certain scenarios though.
Nice, Alex! I'm always delighted when I make a comment on one blog post and then read a following post that appears to respond to my comment even though you haven't read it yet ;-) This is roughly equivalent to having your boss come to you and say, "Alex, would you please ..." and for you to reply, "I already have". This post contains the kind of specific examples of debugging problems that you need to document if we are going to efficiently get help from our Mozilla mentors.
ReplyDeleteI'm sooo glad you have Kevin to work with on things like the Traveling Salesman Problem. I can't add much to the discussion, since it makes my head spin just trying to follow the Wikipedia links on NP-hard, NP-complete, superpolynomial time, etc. You are among the small group of high school students who are ready for this kind of discussion while they are still in high school. I'm a high school teacher, and this kind of thing is frankly above my pay grade :-( Kevin encouraged me last Thursday to get involved in this discussion, but all I can say is that I learned several years ago that the most effective way I can contribute to your education at this level is to actively search out willing mentors like him.