Code Monkey learns with Learnaroo

On again off again. I seem to go through phases where I really want to learn this stuff and then I always peter out on it. That’s OK. Somewhere in my mind I always have a desire to learn it, I just don’t always have the focus to turn that desire into time and action. A few days ago I got the focus again. I had heard about Codecademy in the past and that it was the best free way to learn how to code. They don’t teach Java. That was sad. I played around with the idea of just using it to learn a different language, but ultimatley decided that I needed to work specifically towards what I actually want to do, code Android apps. For reference, Codecademy currently has tracks for Web Fundamentals, jQuery, JavaScript, PHP, Python and Ruby. I also thought about going back to Treehouse. I really loved the style of that site, the fun videos and how quickly I was learning. The code challenges are great too. I just can’t afford the $25 dollars a month. Diapers and baby food are more important than me learning a new hobby. I highly recommend the site to anyone who can afford it though! Treehouse has tracks for Android Development, Web Design, Web Development, Rails Development, iOS Development, PHP Development, WordPress Development and even Starting a Business. You can use this link to get a free month’s subscription to try it out (it also gives me $5 off for every month you are subscribed!).

Okay, enough with the sites I am not currently learning! I found Learneroo. It seems alright so far. It doesn’t offer as many options as Codecademy or Treehouse do, but it does offer Java. The rest of what it offers are more nebulous. Here is the list of their modules: About Programming, Combinations & Permutations, Learn Programming with Java and Logic and Loops Practice. I started with the “About Programming” module which I found to be quite good. It didn’t really go over anything I didn’t already know, except an over view of the most popular languages and what you should learn based on what you want to do. They had a flow chart that pointed me to Java. Then I moved onto the Learn Programming with Java section. I’ve been working through it off and on for about a day. My attention is divided between it, my baby girl and a house full of company so it’s slow going, but I thought I would stop and revive this blog.

I’ve also started looking into ways to make a bit of cash on the side online. I’ve found a few site that pay you to do simple things. I figure if I can pay for my Netflix every month and get a bit in my paypal account it can’t hurt. Hopefully when I’m ready to publish my first app I’ll have enough to pay for the dev membership to the play store. I made a quick blog that talks about the sites. Feel free to check it out here.

Advertisements

Code Monkey Tries to Animate

As I mentioned that next step is adding animations. It’s a bit daunting to me to be honest. To start I skipped the video and downloaded the files Tree House provided. They were 22 Crystal Ball images where they ball basically lit up all mystical like and then faded back to the original. Once I saw that I thought about what I wanted Yoda to do. Speak the answer, obviously. I fired up Episode I and found a scene of Yoda talking. It was harder than I expected to find one of him close up and straight on, but I found one from the Council Chambers that should work well. That, as it turns out, was the easy part. Next I had to compile a number of screen shots from the film. Not too hard using VLC. Then cropping them all since I didn’t want the entire frame. THIS was difficult. I found a plugin for GIMP that allows batch editing of images so you can do the same thing to multiple images. Perfect! Except it only allows some basic fuctions, which while cool and time saving, still left me with a lot of work to do to get my 52 images ready to animate. I used the plugin to crop them all to the same size. Then I went through each one individually and applied an elliptical cutout around Yoda using the same X, Y coordinates so that he wouldn’t bounce around while animating. If anyone knows of an easier way to do things like this please let me know!

One of the Fifty-Two Yoda images I edited to make him Talk

Once I got those all the way I thought I wanted them, I finally fired up the next video to learn what to do with them. The files they included for download for the Crystal Ball animation included an XML file that I recreated for my yoda animation. I did that and followed the instructions for actually coding in the animation, and was greeted with the following:

Error message

My App has Stopped

That is pretty much where I am right now. I’m currently going over what little debugging I know to try and find the cause.

Code Monkey Makes Pretty Little Changes

Hello everyone! I continue to work through the Android Developing Adventure at Tree House. I’m on Stage 3 of building a simple app. It is titled “Pretty Little Things.” As you might have guessed we are prettying things up a bit. They added a crystal ball image to their background, but I found a nice image of Yoda looking wise to use.  A fair bit of what we covered here I have already learned, but doing it again will help to cement it in my mind and learning from a different source allows me to pick up a few new tips.

I’m running into more issues from using Android Studio as opposed to Eclipse. We went through adding a Theme (or rather changing from the default one) to the application in AndroidManifest.xml. They were able to simply pull up a nice interface that let them choose the Theme from a list of them by clicking on the Application tab at the bottom of the androidmanifest page, but I didn’t have that tab (or any of the ones shown in Eclipse) so I had to figure out where and how to add it manually to the xml code. Not a huge deal, but it was a bit of a setback for me. I wish they had covered both ways in the video, but I understand they want to keep it simple and if I had followed the first step in their videos I would be using the same IDE they are.

Theme Code in AndroidManifest.xml

If you look closely at the above image you can see we also set our main activity to only run in portrait mode. When we got our image added and changed the theme we ended up with no button or text on our screen. They were actually still there, but behind the image. We re-ordered the components in the component tree and could once more see everything. There was still a problem through. Our button was now right on top of the image. We moved it down to the bottom. Next we wanted to get the answer text to appear as if it was floating in the crystal ball (They did anyway, I followed along and made the words float over Yoda’s face). We added a Linear Layout (horizontal) and placed our Text view in it. To center our text view we added two blank views to either side of it in the Linear Layout and manipulated the weight of the three components. I could not find the blank views that they used in Android Studio so I used something called Spaces that were described as simple views. They did the trick the same as the views, but it appears they are from a later API and I might have to tweak that at some point. Once we got the Text View inside the Linear Layout lined up where they wanted it for their crystal ball, I moved mine down below Yoda’s Face. Before I’m finished with this I would like to add a something that says “Ask Yoda” above his image. Here is what the app currently looks like when you open it.

Opening Screen at this point

Background changed to Green since Yoda answered in the Affirmative

I was planning on continuing, but I just noticed the next part is on animation. I don’t feel up to tackling that right no so I’ll leave it here for now.

Team Tree House?

I’ve started using teamtreehouse.com since reading about it for the first time yesterday. I’m not sure how far I’ll be able to go with it because it is actually a paid program (service?) and I don’t have spare funds at the moment. I was however able to score a free first month through a promotion I found, so I’ll try to make the most of it. It is way more interactive than simply watching videos. It includes quizzes, and coding challenges that let you know if you got it right as well as the usual follow along videos I have come to know from mybringback and other sources.

Mike the frog, Team Tree House’s mascot

I started at the beginning of the Learn Android Adventure and am just working my way through it. I have learned a few new things. They recommend always using scale-independent pixels (sp) which I think I agree with. They will scale based on the size of the screen as well as the user’s font setting for the device. If I understand correctly using density pixel would stay the same size no matter what the user had the device’s font to set to. This would potentially cause your app to be unusable by someone with poor eyesight who had the font set to large so they could read it. That would be bad.

I’m also learning about arrays! Arrays can be used to store a number of different values from one data type. You tell the computer that it is an array by using square brackets after the data type (String[]) and then open curly braces to start your list of values. That was a terrible description so I’ll just include a picture of my code for the app tree house has me making. Actually, I’m altering the app a little. They are making a Crystal Ball app, and I’m not into that, at all. So I am making an Ask Yoda app.

My First Array in Java/Android

I was excited to cover if statements because mybringback hadn’t touched on them yet and I remembered them being such a big part of the course I took on Python.  It seems like they will be a fairly big part of Android dev as well, and I imagine of any type of programming. Before we made our array as seen above we simply had 3 possible answers: Yes, No and Maybe. We had a random number generator (Which is also new for me in Android) that could give us 0, 1 or 2 when we ran it. We used this with an if statement to assign 0 to Yes, 1 to No and 2 to Maybe. This worked great and was a simple way to introduce if statements. When we added are array we pulled that if statement out. I have added a new one to my code though that changes the background color dependent on whether the answer was positive, negative or neutral.

If Statement to change the Background text

I’ll stop there for now. I’m really liking Team Tree House. I really think I’d like to continue using it after this first free month runs out. I’m going to see if I can work it into my budget somehow. That said, if you are interested in learning anything in their library please consider using my referral link. It will get you 50% off your first month and I’ll get $5 off my next month.

Learning Adventure 

Some of the things you can learn

Here’s my referral link: http://referrals.trhou.se/tonywhitney

 

 

Dur, Spelling is Hard

Hey guys, Another weekend of lots of gaming and near enough sleep, but I got back at coding Sunday afternoon. Started out with lesson 15 over at MyBringBack. In this lesson we finished up the current activity we’ve working on. We made the Radio Groups for Gravity and Typeface work. We fleshed out the onCheckedChanged method we created as a stub last week. I’m not really sure how to walk through this, but I’ll post a picture of my code.

Code that makes our Radio Buttons work

Let me take a stab at this… Let’s look at the first case (rbLeft). In case our Left Radio Button is checked, set the Gravity to Gravity.LEFT. That will make the text align to the left side of the screen. Well, that wasn’t too bad. But it get’s more interesting when we get to the Typeface ones, so let’s look at rbNormal and see if we can make sense of it. In case our Normal Radio Button is checked set Typeface to Normal. That is what it does, but does all this mean? “Typeface.defaultFromStyle(Typeface.NORMAL), Typeface.NORMAL” Why do we need all that instead of just something like Typeface.NORMAL? I’m not sure. Hopefully it all becomes clear at some point in the future. In the mean time let’s take a look at our activity in action.

Our text with Typeface set to Normal and Gravity to Center

Typeface set to Bold and Gravity set to Right

Lesson 16 had us working on the menu. You might have noticed that this blog post is really late. Well that is because the lesson burned me out a bit. It all seemed simple enough. And in reality it was. But my inability to spell hurt me. Worse than that my inability to notice my spelling mistake for the two hours + I spent staring at my code to try to solve my issue. I ended up sending my who project to a friend who knows more about coding than me and he found my error (Thanks Glen!!!). By that time I was pretty discouraged and spent the week gaming instead of coding. Ready to get back at it now.

Return of the Code Monkey

Or should that title read “Revenge of the Code Monkey”?

So, you may or may not have noticed I have not blogged in a very long time. The last time I graced this blog with my presence was back in November, 2012 which would be, oh… about 6 months ago. Yep, half a year!!

If you were paying attention, you know that I was taking an online course through coursera.org. I was attempting to learn how to code in Python. I bet you have a few questions. And if not, that’s ok. I’ll answer them anyway!

1. Why did the Monkey stop blogging about the course?

This is pretty simple. The course was really challenging for me. It took most of my free time just to watch the lectures and complete the assignments. With working full time and doing the course, plus spending a little bit of time with my wife, I didn’t have the energy to write much.

2. What did the Monkey think of the course?

As I mentioned, it was hard for me. I’m not really that great at math and I quickly found out that the course was going to require a lot of it. I ended up doing some extra homework to bring my math skills up to par. You see this particular Monkey seldom payed attention in Math Class. Plus High School is a few years ago now… “I’ll never need this in real life!” “This is dumb.” “Why are there letters in this math?” are all phrases you might have heard uttered by me in high school. Sorry Mr. Bodnarick. Funny aside, earlier this week I asked my 14 year old niece what she learned in school that day. “Nothing.” she replied just like every time I ask her that. I pressed on and she told me she had learned something about triangles inside of circles and that she would never ever use that in life. I felt very old as I explained to her that I used to think that about everything taught in Math, but now I wish I had payed more attention. What she was learning this week might have helped me build pong in Python! Woah! off topic. Once I made it past each math hurdle thrown at me, I enjoyed the course. It was challenging but I learned a lot about coding and about how to think about programming. While taking it and ever since I find myself thinking in If/Else/Then statements a lot. Hopefully this type of thinking will help me as I continue.

3. What have you been doing since the course ended?

Not coding. I actually did not complete the course. I didn’t plan it out too well and for the last 2 weeks of the course I was in Disney World. I had the course loaded up on a laptop with the intentions of doing it there and I did work on it a bit in the first few days, but in the end the sunshine and the “Magic of Disney” won out and I chose to just enjoy myself and see and do as much as I could while there.

2012-12-04 10.22.36

And when I got home? I had lost momentum and didn’t pick back up where I started. Instead I ended up playing video games. (Star Wars: The Old Republic in case you were wondering) I stopped coding all together. I couldn’t convince myself to finish the Python course alone using an online IDE (codeskulptor.org) that I would never use again with a programming language I didn’t really plan to use in the future. I didn’t get back into Android coding either. I did nothing,  and then life got a bit crazy. My wife and I moved 669 KMs (416 miles) from where we had been living. We had a beautiful baby girl. I left my job as a Computer Technician and started life in a factory making corn chips. In short a lot of big changes in a short time.

4. Why is the Monkey returning now?

AndroidStudio

Google I\O 2013 unveiled the Android Studio IDE. Seeing this announcement reminded me that I still have apps I would like to make and a desire to know how to make apps in general. Shortly after I was downloading the new IDE and looking for tutorials again. I’ve decided to stick to strictly Android developing. It’s what I want to do and I feel the Python course was a great intro to programming in general, but I’m want to focus on things I can apply directly to my app idea’s. I have Evernote notebooks filling up with thoughts and plans, but I don’t know how to implement them yet!

My first step back into the coding world will be to go over some video tutorials from bringmyback. I watched the first one which was on Eclipse/ADT/SDK install. All made very simple with Android Studio! I bet soon I’ll be making another “Hello, World!” app.

If you have any tips or suggestions I would love to hear them in the comments.

Code Monkey says goodnight.