Monday, June 17, 2013

Problem 1: Can't install Git, try running Update; Can't run Update, please install Git

My CoffeeScript PeepCode screencast started off by telling me to install HomeBrew.

The HomeBrew installation is easy enough on a Mac, I literally just ran:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

and HomeBrew was installed properly on my machine.

However, the instructions then said that I should run "brew doctor" before doing anything else, as a way of ensuring that everything was up and running properly.  So, I run that command:

brew doctor

And it says:

You must: brew install git

So I do that:

brew install git

And it replies:

Failed to execute: make
Error: Homebrew doesn't know what compiler versions ship with your version
of Xcode (dunno). Please `brew update` and if that doesn't help, file
an issue with the output of `brew --config`:
  https://github.com/mxcl/homebrew/issues

Ok, so I run "brew update," and I get:

You must: brew install git
Error: Failure while executing: git init 

Hopefully, by now, you're picking up on my frustration.  I can't install Git until I run "brew update", and I can't run Update until I install Git.

So I go to the Git HomePage and download the GUI installer.  I run it, it says "Installation Successful!", but, when I try to run 'brew update' again, it still complains that I need to install Git.  I try running "which git" to see where Git was installed, but my Mac can't seem to find it.

Asking around the office led me to the solution:  the Git GUI installer installs Git to /usr/local/git/bin, instead of /usr/local/bin.  So, I added /usr/local/git/bin to my PATH, and everything worked wonderfully.

-----------------------

Update

Turns out you can bypass all of this mess by simply installing Xcode, which is free from the Apple AppStore.

When my HomeBrew told me:

Error: Homebrew doesn't know what compiler versions ship with your version
of Xcode (dunno). Please `brew update` and if that doesn't help, file

I assumed it meant "you have Xcode installed, but there's something wonky with the compiler version."  Turns out it could also mean "you don't have Xcode installed."

I installed XCode onto my machine, after which "brew install git" worked just fine.

I'll probably delete the "regular" version of Git so that it doesn't conflict with the Homebrew version.

The King is Dead; Long Live the King

So my foray into Android was pretty short-lived.  Turns out that it's really difficult to find time to learn a new language when your place of employment has no use for that language.  Sure, I could've spent more time learning at home, but, as I don't *need* to learn Android, it was never high enough on my priority list to actually sit down and do it.

So, it's on to a "new" language:  JavaScript.

Now, I put "new" in quotes because I already "know" JavaScript -- at least I thought I did.  After all, JavaScript was a huge part of my job description at Shutterfly when I was hired here 5+ years ago.  However, there were so many advances in JavaScript and its use during the past 3 years that I've spent writing Flex code, that I feel like I don't know JavaScript anymore.  To put it into perspective, I've never used JQuery, and that puts me into the "elementary" level of JavaScript coding by today's standards.

When I told some colleagues that I want to learn JavaScript, it was recommended that I learn CoffeeScript instead.  While I initially rebuked, because why learn B when you're trying to learn A, some good points were made:  most significantly the point that CoffeeScript translates *directly* to JavaScript, and can help you learn the "correct" ways to write JavaScript, without having to suffer through all of the "wrong" ways.

So I'm off to learn CoffeeScript using a screencast from PeepCode at https://peepcode.com/products/coffeescript/.  PeepCode, unfortunately, is not free.

I'll also be referencing the O'Reilly book, JavaScript: The Good Parts, which can be downloaded for free at http://it-ebooks.info/book/274/.

Saturday, July 28, 2012

First Problem! AVD Creation with Android 4.0.3

Ran into my first error today, and it was before I wrote a single line of code.

When creating your Android Virtual Device (AVD), Professional Android 4 Application Development recommends using the Galaxy Nexus skin (WXGA720) to skin your emulator, like so:


So I went ahead and did that, and then tried to run my AVD...


The error reads:  
Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Well that's not very helpful.  Failed to allocate memory for what?  And what does the 8 mean?

I did some Googling, and found my issue.  It turns out the default resolution for the Galaxy Nexus skin is 720x1280, while my PC's resolution is a measly 1920x1080.  When trying to launch the emulator, it seems Eclipse tries to fit the AVD's display inside your screen, and, if it doesn't fit, crashes with a not-so-helpful error message.

The Solution was simple enough: I switched my skin to WVGA854, with a native resolution of 480x854 -- small enough to fit on my screen -- and boom, Hello World!


"But you said you hadn't written a single line of code yet," you exclaim with bewilderment.  "Hello World" is the default activity created by Eclipse when you start a fresh Android Application Project.  Technically, I deleted a couple of lines that centered the text, but deleting is not writing...

Note: I also ran into the following error starting my AVD a few times:

ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration.

This just means you've been messing with your AVD hardware configuration too often.  Launch your AVD from the AVD manager with "Launch from snapshot" unchecked and "Save to snapshot" checked, and it should do the trick.

Thursday, July 26, 2012

The Android Adventure Begins

So I've decided to get serious about Android development.  I still see it as a new technology, but it's really starting to spread its wings, and I'd love to get in on the ground floor, or, I suppose, as close to the ground floor as I can get with a technology that's been around for 5 years.

I've tinkered with some Android development over the past few months -- messing around with a prototype app at work -- but, up until now, my knowledge has come from cutting/pasting/tweaking existing code, and Googling "how do I [something] with Android?"  I've realized that this is a frustrating approach to learning any language, as you end up reading questions posed by people at the same knowledge level as yourself (close to none), but answered by people who seem to have vast expert-level knowledge, whose tips and advice fly right over your head.  I ended up with rough ideas of how to perform the specific tasks I was looking for, but I wasn't getting any closer to having a solid understanding of the Android language as a whole.


So today I went out in search of a book to help guide my way, and by "went out," I mean I went to Amazon.com (c'mon, who goes to book stores anymore?).  After scanning reviews for a while, I settled on "Professional Android 4 Application Development" by Wrox (as of this writing, the Kindle edition is $24.74).

I'm just getting started with this book, but I'm already pretty fired up about tackling an interesting new (ish) language.  Not only do I hope to enhance my marketability, but I also hope to be able to create some cool editions to my own phone.  It should be fun.

Addendum:

Since this is my first blog post, I guess I should lay out a mission statement of sorts...

This blog is intended to be an amalgam of my experiences with software application development:  musings on particular coding issues, code samples, and anything else related to development that might pop into my head.  I hope that it not only helps me to keep track of my growth as a developer, but also acts as a helpful resource to other developers who might be tinkering in similar areas.  For the record, I don't expect this first post to help anyone, except for maybe Amazon if anyone reads this and decides to buy the same book I bought.  So, you're welcome, Amazon.