Monday, March 30, 2015

Week 7

Dear Blog-Viewers,


Welcome again to another wonderful week in the world of computer science. This week, I overcame a wall in my programming–dealing with networking! Last week I figured out how to automatically convert street addresses into latitudes and longitudes among other Java concepts with EcoMap Editor. This week I learned how to gather that information and synthesize it into the EcoMap iPhone app through different methods of networking. I learned that all of the important code is run in something called a closure which captures data from the network. But all methods related to that data must be run within that closure and closures cannot return values…


At first I felt like this^.. so confused. (Even Shrey Gupta apparently doesn't always understand. Just kidding, he does!) But then I remembered what I had learned about with multi-threading. The tableview (as you will see in the next image) of services must be populated with data once the data has loaded from the network; the closure ensures that all the data has been gathered from the network before any of it is used. The program would otherwise just appear to be blank. So finally I figured out how to deal with networking issues and populated a tableview. 

I am proud to reveal that the iPhone app is really taking its shape! For weeks I have been learning concepts like data handling, multi-threading, and basic swift developing techniques. But now, all of these concept have come together into what looks like a somewhat usable app. You can see each row has a green title, a transparent, unobtrusive description, and an image of the site to show what that service is all about.



Next steps include creating a home/introduction page, designing pretty buttons, creating a detail view that allows users to get more information by tapping on a service from the above table, and figuring out how to get information about what materials are needed most at different composting locations. 

With regards to that last feature, different compost locations might have different needs. For example, if there is a large supply of banana peels in one bin, it is possible that the location might need more leaves and paper shreds to chemically balance the compost pile. Being able to regulate what materials go into compost bins is essential to the most efficient production of soil.

Monday, March 23, 2015

Week 6

Hello Blog-Viewers,

Although learning to program well while trying to develop a new product has been at times arduous and time consuming, I am pleased to report that I have finished the application EcoMap Editor. This app allows the ScrapZero company to edit data on the iPhone app (EcoMap) without having to be a programmer. Here it is running: (As you can see, I've left the last column open for me to add notes to myself for the future.)



I spent this last week finalizing what I am currently calling EcoMap Editor. I've had all of the code ready for a while, but once I exported the code to an actual project, I realized a few things. First of all, my code used commas to delimit the text files that it imports. Essentially this means that the user of the program is restricted from using commas in sentences. This was not a difficult fix as I simply converted these commas to "***" and then converted these symbols back into commas when the data was retrieved by the iPhone. This might make a little more sense with the following diagram of the program's workflow:



Essentially, the app that I just finished takes computer jargon and turns it into human-readable text which can be edited and converted back into computer-speak. But typing commas when running the EcoMap editor simply messed up the program making it useless.

The second problem was that the program would only import this text file that I mentioned in the java developing platform, Eclipse. This is where the programmer makes his or her basic code to later export. Once I exported my files to be run as a stand alone applications, the program could no longer import the text file. So I ended up having to find the current path of the running program through some slightly more complex methods. The complexity wasn't as much of an issue as was the strain of rewriting my (at once functional) code. But I finally fixed all of that and got to the fun part of programming, design!

So I finished the week making the icon for EcoMap Editor in photoshop. It's simple and elegant.



I know this blog post has been unusually technical and possibly confusing. Please ask anything that you don't understand. 

Tuesday, March 17, 2015

Week 5

Hello Blog-Viewers,

Welcome to another week of my blog. I apologize for how late I am with writing this post. I have two excuses: I spent the weekend volunteering at the Scottsdale Arts Festival which drained my energy and put me directly to sleep when I got home. Secondly, I was hoping to be done with the next portion of my program before posting. I guess this stuff really takes a long time because I am still in the process.

But here is what I did this week:

Thanks to Mr. Chen's computer science class, I was able to quickly put together a java program that lets ScrapZero employees edit the data that shows up on the iPhone application (previously discussed) without having to understand anything about programming. This program was supposed to look a little bit like the following:

Essentially, "New Data Type" adds a new column and "New Service" adds a new row in the table. Here you can click on any of the grey blank spaces and add new data to fill up the table. This JSON Creator program automatically sends the finished file out into the cloud where it is then transferred all the users' iDevices so that data is always up to date.

Unfortunately, AP Computer Science doesn't spend too much time on making GUIs or graphical user interfaces so what I came up with is  what you see below (on the left side of the screen.) The functionality is there, but I still need to make this appear more like the interface I originally designed in photoshop.

Although the JSON Creator app is not entirely complete, it has been satisfying to know that a simple computer science course in high school could be so helpful.

Saturday, March 7, 2015

Week 4

Hello Blog-Viewers,

Welcome to my fourth week of working with ScrapZero. Last week I set a goal of completing the program by this past Tuesday. Unfortunately, time has past and I have yet to complete it. 

I discovered something new about programming this week—threading. Apparently, in most computers, programs run operations simultaneously and do not always follow the order specified by the programmer. Logically, this would seem to speed up computer processes and it does.. But it definitely slowed down my process (of completing the program.) 

So here is an example of multi-threading:

If I have two functions, “f1” and “f2”, I might choose to run “f1” before “f2”. Logically, in a generic programming language, one would write:
“run f1”
“run f2”

The problem is that “f2” might have already completed a task before “f1” finished. In my case, “f2” was highly dependent on the results of “f1” which basically made the program fail every time. 

So what did I do about this? I learned how to use multi-threading in programs to my advantage. In the Swift programming language, there is a method of prioritizing events with a block of code that looks like this:

 dispatch_async(qos, { () -> Void in
//code to be run goes here
}
//qos is another variable that defines how important the process is.

I probably should not go into too much detail as these processes are still a brain teaser for me. 

So I finally fixed my code and the app is running properly. Although the app is not complete, I am going to start building an interface for ScrapZero so that it can easily modify the JSON file that I mentioned in the last blog post. This way, I won’t have to be the one to update the information that is uploaded to the app. 

Thank you for checking out my blog. I hope to have some serious results in soon.

Lorentz

Saturday, February 28, 2015

Week 3

Hello Blog-Viewers,

Welcome to my third week of software development. This week, I began to focus on coding once again and plan to have my app finished by this Tuesday (an arbitrarily chosen date; however, I need to feel that I have accomplished something.) This week, I worked on making my app dynamic such that new information can be added to the app even after I have published the final version to the Apple App Store.

So I thought learning the Swift programming language would be enough for me to create the app. But it turns out, I need to know JavaScript and JSON to make the app dynamic. I spent some time learning these languages and applying some of what I already knew.

So here is an inside look into the code that I have written:
This is only a very small section of the code from this file. And there are many more files that I have written. Besides informing you of the work I have put into this, I wanted to show that all these language come together.

So essentially, the Swift code now imports data from a website that I have created every time the app opens. This allows me to update locations in the map  view and other data on the home screen. This is how the map to the right knows where to place the place marks. As you can see, I was only testing the code and that is why there are only three place marks. I am going to copy and paste the other locations soon.

Saturday, February 21, 2015

Week 2

Hi blog-viewers,


         Welcome to my second week of work spent on software development and data gathering. I spent my week gathering information about local compost services that can be added to the map that I have started to develop. Initially, I doubted the usefulness of my app considering that people could simply find local compost services for themselves; however, after researching these services on my own I realized how difficult they were to find. This app is going to help people synthesize this information into a readable format and allow people to focus on what is important to them–those services that are most nearby to the user. last week I started in on the app development perhaps too quickly. I needed to get my information and set a goal; and this week I have worked on those two things.
After I created my plan for this app, I needed to focus on finding ideal conditions for composting, discover what can and cannot be composted. The home page of the app now contains this general information and there is a tab that allows users to find local services if they don’t wish to compost on their own. I hope to make the app as general as possible so that it can be used even by people not located in the Phoenix area.

Saturday, February 14, 2015

Week 1

Hello all,

Welcome to the end of my first week with ScrapZero. Although I am working mostly with ScrapZero for my project, I am also working to increase general awareness to the benefits of composting, as well as to the ease at which it can be done. This week, I started producing an app for Phoenix Renews which is a company/project that allows people to become urban farmers and/or dispose of their organic waste in a sustainable way. 

You can check out more of what they do at the following link: http://phxrenews.org/

Here are some pictures I took while I was on site. 




As you can see, the site is becoming fertile; artists have created paintings and other artistic features to make the environment more inviting.


So what have I been doing? This week I spent most of my time reading through source code, swift programming documentation, and finally spending the remaining time building my own app. Because swift is a brand new language, it’s been a little bit difficult to learn, but I am working hard and figuring it out. It turns out that the most comprehensible tutorial on swift came from a some German programmer on YouTube. I couldn’t exactly understand the German and I don’t think the captions conveyed what he meant either… However, this mostly inscrutable–with regards to language–tutorial, is what has helped me most so far.



If nothing else, these tutorials were entertaining! Gotta love the language barrier.


So now I have developed the beginnings of an application for the iPhone. At this point, the app simply finds one’s current location and shows what urban farm/waste management centers are nearby. This next week, I plan to add more information about what can be composted and what materials are needed most at these centers to make the most efficient decomposition of organic food waste into fertile soil.