Wednesday, February 4, 2015

Changes 2/4/15 - Thanks computer

Today my computer crashed and I had to spend 20 minutes troubleshooting and waiting for it to repair itself, which really sucked.

We had a conference call with Marcia from Firefox, and we talked about Firefox OS development.  It was pretty cool talking to someone actually developing a phone!  She also answered some of our questions and offered to set us up with mentors, which is a really cool opportunity.

I also kept working on my button, but thanks to my computer crapping out, I didn't get very far.  I added some more styling for the base state, and started working on the styling for the active state (when it is clicked)


Here's the button:

Click Me!

It still needs to change color when clicked though!

Tuesday, February 3, 2015

Changes 2/3/15 - Buttons!

Cool button

Today I made a button, and added another page to my app! Compared to android, where you have to create a new process (or something, I can't remember) to display a new window, in Firefox OS it is so trivial! You just create a new html page! Tomorrow I'm going to work more on the button, giving it hover and click attributes, and fix up the styling a little bit.

Monday, February 2, 2015

Changes 2/2/15 - Firefox OS API

Today I researched some of the API features of Firefox OS.  I tried to make an app that uses the camera, but realized that the emulator just has a black screen when you try to open the camera.  Instead, I looked at the documentation for how to load an image from the camera or storage, and pasted their code into my document.  Basically, you end up loading an image into javascript, calling a function that generates a URL for that image, and setting an image's src property to the generated URL.

Tomorrow I'll look more at what I can do with this for an actual app.

I also helped Finn troubleshoot his app, since Firefox OS places a bunch of restrictions on what you can and can't do within your code.  They are trying to completely separate the html from javascript, and so they don't allow you to have an element with an onclick property.  Instead, you have to define an event listener in Javascript.  This makes sense, because if they allowed this, someone could make an html page that had something like <body onload="//malicious code">.


Friday, January 30, 2015

Changes 1/30/15 - Firefox OS!

Started working on Firefox OS, which is actually really easy to develop for.  Since it's all web based, it runs very smoothly within firefox and even comes with a built in IDE, right in the browser!

I wrote a quick Hello World app, which was really easy to set up and push to my local emulator.  The hardest part was getting access to the jQuery library I was trying to use.  I assumed the phone would have it built in so that not every app had to have its own copy, but apparently that's not the case.  Once I figured out that I needed to download a copy of jQuery to get access to it, everything went smoothly.  I wrote a quick app that displays some text.

It's really nice that since the emulator is using the browser to render, I can use the Firefox element inspector to alter how my app displays while it is running, which can be really useful for previewing changes

I can also paste my code right into blogger, and with a little bit of tweaking, have my app running embedded in the page!  That's really cool!

This is what it ended up looking like:




World

Thursday, January 29, 2015

Changes 1/29/15 - Printing a heap, Firefox phone

                98
        77              83
    63      70      58      62
  18  7   17  30  28  54  10  22

So I got the formatting to work! Sam gave me a hint--his program based the spacing between each node (Such as the spaces between 77 and 83) on the total number of columns available on the terminal. In my code, the spacing between each node is calculated with the expression:
" " * (str_width // (2**level_index))
where str_width is a constant dependent on the columns in the terminal and level_index is the level of nodes currently being iterated over (so for 98 level_index would equal 0, for 77 and 83 it would equal 1, and so on).

The left offset, or the whitespace to the far left of all the nodes, is calculated by dividing the spacing between each node by two:
(" " * str_width // (2**level_index + 1))

This approach works very well, but I wouldn't have been able to figure it out on my own. I guess it makes sense, but I just have trouble wrapping my head around what I'm doing. The only reason I got this to work at all was because I played around with the math without really understanding what I was doing and happened to eventually hit the right answer.  It's really frustrating though because I'm just not good at thinking in this sort of way.

I also got Firefox Hello to work, since we are going to be videoconferencing with some people over at Mozilla at some point in the future.  I started looking at the oneanddone site, but ran out of time.  If we only have one Firefox phone between the three of us, I don't think we all really need to do these though.

Changes 1/28/15 - Heap printing

Worked more on my heap output. So far the best I've gotten it is
                       98
                77            83
        63        70        58        62
   18    7    17    30    28    54    10    22
So the spacing isn't quite right. I've kind of run out of time to blog the past couple of days, I'll make sure to blog in more detail tomorrow about what I've been working on. Sam also showed me his implementation, which I think is going to help with the spacing problems I'm having.

Tuesday, January 27, 2015

Changes 1/27/15

Today I worked on extending the heaps.py file so that it can print out the heap with proper structure.  It's pretty tough--I got the output to be correct after a while but the spacing is way off, so it still needs a lot of work.