Tuesday, August 2, 2011

Android Game Development, Step 1:

Go here: http://www.javacodegeeks.com/2011/06/android-game-development-tutorials.html

In all the languages I've dabbled in and all the tutorials I've found on the internet, this is the first tutorial that I've found that covers everything you want to know without all the other junk.  It's quick, it's simple, and it gives you all you need to start on a path to game development on the droid.

I challenge anyone to find a better tutorial.

Thursday, July 28, 2011

How to get Ruby on Rails running on Android with a sqlite database with zero knowledge of rails, Android, and sqlite

My previous post about getting Rails running was really only a pit-stop on the way to my real goal of getting my Android tablet to talk to a Rails server.

That's what I searched for first, which led me to the instructions for installing Rails on PC. So, to back up, I was looking for "Android and Ruby on Rails," and I got this post:


Which of course, references the other Google top search which is this:


So after figuring out how to get a Rails server running on PC (documented in my previous post), I decided to start with Gertig's demo project for Android (downloadable at the top of the link above).

Unfortunately, that did not work out of the box. Mainly because he only provides the source for the Droid app, not the Rails. So I jumped over to Michael Maitlen's blog (mgmblog link above) which Gertig referenced and took a look at his httpclient hello world, hoping that it would show me the Rails side of things.

Knowing nothing about Rails or Ruby(except what I gleaned from setting it up in my previous post), it took me a bit to puzzle through Maitlen's code and to realize that the commands he's using won't work if you've followed Gertig's instructions for setting up Rails on PC. If you have, here's what you need to do to create a Rails project for Gertig's demo Android project (note, I made changes to Gertig's demo, keep reading to find out what):

- DroidRails is the name of my project -

  1. Start Command Prompt with Ruby
  2. cd to your RailsApp folder
  3. code:
    >rails new DroidRails
    >cd DroidRails
    >rake db:create
    >rails generate scaffold events name:string budget:string
    >rake db:migrate
    [next, I did this in a new ruby cmd prompt, but you shouldn't have to]
    >rails server

Alright, I still know next to nothing about Rails, but from what I gathered, the above code creates a Rails project with a sqlite3 server (from when I setup Rails), adds a template (scaffolding?) for a SQL object called "events" with the entries "name" and "budget" which are both strings, and starts said server. From there, I can contact it with Gertig's demo Droid app.

Now, for the changes I made to Gertig's project to get it to work (this is required if you're going to create a server like I instructed, but I'm sure after reading, you'll be able to tell how to write a server to fit Gertig's project 100%):

  1. in AddEventView#postEvents()
    1. set the HttpPost to your local ip (note: my ip did not match Gertig's comments)
    2. change "budget" into a string and access just like "name" (I did this for simplicity's sake, I didn't want to worry about data types on the Rails or Droid to start)
    3. change "myevent" on line 85 to "event"
  2. in RubyMain#retreiveProjects()
    1. change the string url on line 68 to your ip (match HttpPost above)
  3. in RubyMain#parseXMLString()
    1. on line 136, change “myevent” to “event” for the nodes
    2. change “budget” to a string, update the set on line 153 to get a string like “name” does

Troubleshooting:
The three most likely culprits of any problem are 1) your Rails project isn't setup correctly, 2) your Droid project doesn't match your Rails project, and 3) your ip is incorrect.

If you followed my instructions above, 1 and 2 should not be a problem. If not, here's the main issues I ran into:

For 1:
  1. If you follow Gertig's Rails setup blog (which I followed in my previous post), and you try to build the Rails app by following Maitlen's instructions, you're doomed to fail.
  2. I found this site: http://guides.rubyonrails.org/getting_started.html helpful in figuring out how a Rails server should be built, and I compared the commands in it with Maitlen's to figure out what I needed to do.

For 2:
  1. If you followed my instructions for 1, then you'll need to follow all of them. In my Rails server, I changed “budget” to a string to further simplify the app. I also changed the name of “myevent” for no good reason.
  2. If you change the names, Rails does some interesting stuff automatically. To get my project working, I actually had to use Firebug to analyze the call made by the Rails test page that's generated for you (http://localhost:3000/events) in order to see what was being posted when I made a new event. Working backwards from that, I figured out how to alter Gertig's project to match. If something's not working, that's where I would start looking.
    [Note: one of the weirdest things here is that I used “events” in my server, but Rails used the singular form for creating a new “event.” It seems to have done this automatically.]
  3. Also, you need the right IP. Localhost works from your PC but doesn't from the Droid (because localhost on the Droid would refer to a server that it's running on itself). I cover the details of this below:

For 3, do the following:
  1. make sure it shows the “Welcome aboard” Rails page. If it doesn't, your server isn't running.
  2. open a command prompt and type ipconfig, hit enter
  3. look at the list of IPs towards the top around “Default Gateway.” The one that worked for me was the “IPv4 address”
  4. go to http://[your IP address]:3000/
  5. make sure it also shows the Rails welcome page. If it doesn't, you've got the wrong IP address.
  6. Once you find the right one, add it to your Droid project.

Wednesday, July 27, 2011

How to get Ruby on Rails running on a PC with zero prior knowledge!

I know next to nothing about Ruby or Rails, so of course, I'm beginning by following tutorials on the internet. A couple months ago, I went to http://www.ruby-lang.org/en/ and did the super intro tutorial at http://tryruby.org/. If I don't get too distracted with attempting to get Android and Rails talking, I think I'll go through the other tutorials referenced on the ruby-lang site. More on that if I return to them.

Beginning here:

Notes:
  1. There's now a selection in the installer for Td/Tk which has something to do with GUI building in Ruby... more on that later if it becomes important. (spoiler: it doesn't)
  2. I'm running Vista, so when I start the gem server, I get confirmation dialogues by the dozen. Good times.
  3. I just installed Ruby for the first time, so I've only got these gems installed: minitest, rake, rdoc, rubygems.
  4. If you follow the instructions to a T, you'll see the following dialogue noting that sqlite3-ruby has changed names.

  1. Though, it no longer tells you to add the .dll to your bin folder, I figured it couldn't hurt, so I added the latest dll to my C:\Ruby192\bin folder. I got the latest by going to the download page and selecting the only one I saw.
  2. I installed rails per the instructions, and I got this sweet error(it says generating docs, so hopefully, this isn't important... :/ ):
















  1. At this point, I would like to note that Rails (or I guess I should say Ruby) scares me. I've just typed a few commands, and some super complex stuff has been taken care of for me (or at least that's what I'm guessing based on what I've read and what I'm seeing happen). This is awesome, exactly what I've always wanted, but it makes me nervous. Didn't someone say something about being careful what you wish for?

And that's it.  Gertig's instructions totally worked.  Now, it's time to follow his tutorial to link Ruby on Rails and Android.

(Note: I've almost got Android and Rails talking, but I left my cable at work, so I can't test the last change, meaning my post on it will go up tomorrow when I'm sure it works.)

    Tuesday, July 26, 2011

    How to remove a payment method on Xbox Live

    Wow, I've only been annoyed by this for a year.  Finally, I stumbled upon it when canceling my App Hub service for launching XNA apps on the 360. :(

    Here's how to remove an old payment method (read: expired credit card) from Xbox Live.  Why they made this so difficult to find is beyond me:
    http://support.xbox.com/en-us/pages/xbox-live/how-to/xbox-live-account-management/default.aspx

    Oh, and about getting rid of my XNA service.  It feels like giving up, but really, I can still develop for it.  I just can't deploy to the 360.  But after a couple of years of barely using it, I'm ready to stop giving Microsoft my money.

    I realize now that I was disenchanted by how Xbox Live Indie games never really took off.  I guess they still could, but it's been a long time, and the next Xbox console is likely looming over the horizon.  I hope they continue the initiative, but they need an overhaul.  They need a marketplace akin to that of Apple's App Store.  People need to be told what to buy and given ways to pass it on to friends.

    It's funny, my work may never be seen on Android either, but at least on Android I feel like it could be seen.

    Alright, time to get to work.

    So, as I usually do, I'm juggling about a million projects.  They are as follows:

    -learning enough Android programming to make games and a magazine for my Asus Transformer tablet
    -creating content for aforementioned magazine (this includes fiction writing, reviews, music, video, games, art, pictures, design, etc.)
    -learning Ruby on Rails because it would be useful at work
    -picking up new activities (I'm going to try out lacrosse this weekend if all goes as planned)
    -moving to minimalist footwear
    -and all those things I've mentioned previously...

    My plan here, though, is to share my knowledge.  And that's just what I'm going to do.  So, when I'm not doing one of the above things or getting sucked into episodes of Dr. Who and Torchwood, I'm going to document what I'm doing to accomplish these tasks.

    First, a quick tip for would be Android tablet programmers.  Tablets are running Android 3.0 (Honeycomb), API level 11 and up.  If you're jumping right into Android programming for the first time, you'll probably glaze over the whole API level thing.  What you'll miss in doing so is that, if you don't set your MINIMUM API level to 11 or above, you resultant project will not support a tablet's resolution.  So, despite having your target at the latest Honeycomb release, you'll get a nifty little app with a view the size of an Android phone, leaving the rest of your monstrous tablet blank.

    Alright, back to programming.  Hopefully, I'll have some cool info in the near future.  Also, I plan on adding links for all the nifty stuff I find in the future (I lost the link that explained the aforementioned tip).

    Anyway, if you're reading this, I hope you too are doing something awesome.  If so, you should share.

    Sunday, June 26, 2011

    Times are a Changin'

    Since I moved across the country, gave away my guitars, and took up Android programming, I decided to change the focus of this here blog.

    Instead of chronicling my endeavors to accomplish my New Year's resolutions, it's going to be a blog about whatever the hell I want to blog about.  I'm still working on those resolutions, but I'm altering them.  Currently, I'm getting into Android development for my sweet new Asus Transformer.  So I'll still be trying to make games, but I'm also working on a digital magazine with my good friend from 2-thirds.

    He and I are also doing comics, and I'm still trying to learn Japanese.  I seem to make a ton of progress, then stop for a week or two, then pick it back up again.  Learning is hard. :P

    Anyway, if you're interested, updates will come this way.

    Saturday, February 26, 2011

    Life is like a roller coaster

    It does flips and throws you over
    Board your ship that's going nowhere
    If you stop, you'll end up somewhere

    I can finally talk about what's been keeping me from blogging/guitaring/pianoing/Japanesing/programming.  I've been applying for new jobs and have taken one in Arlington, VA.  Obviously, this has interrupted my other goals for this year, but once I move (across the flippin' country), hopefully I'll have some time to sit down and work on my hobbies.

    In the meantime, I've been squeezing them in when I can, and I realized that I have a really great camera that can record really well, so maybe I'll get a YouTube account and start making an ass out of myself on there.  At least then, I can post what I'm doing, instead of just text about it.  Could be cool.  We'll see.

    In other news, my bestest friend ever, Joaquin, has started an interesting new site for sharing his various works in progress.  Cleverly named 2/3rds, after the completeness of the work he'll be showing there, his site will be home to all manner of creative things.  He and I just started kicking around the idea of some collaborations, so I may send some music, art, or writing his way, which I will then pimp here.

    I'm excited about his site because I've been wanting to see other people's creative work, from which I might draw inspiration.  We'll see how it goes.  For now, I better get back to packing.

    Wednesday, February 2, 2011

    Now I see you fell asleep again...

    You've been riding this train since 2AM
    Like the circle of fifths you drew in school
    The loop line takes round and through

    I wish I could fall asleep.  I haven't been sleeping well lately.  Going to bed super late, waking up super early, waking up again sort of early, and finally, waking up late and going to work.

    I've been super busy lately.  I've still been finding time to get my stuff done though.  I've made some major progress on Japanese.  I spent my weekend working on it.  Also, I've made the first round of attempts at finding someone with whom to study.  Having someone who's also learning Japanese, or preferably a Japanese speaker who's learning English, would do a great deal to motivate and help me.

    We'll see.

    The rest of my time has been spent programming and investigating programming.  I'm compiling a list of things I need to learn and resources from which I may learn them.  There are many gaps in my knowledge that need filling.  In the meantime, I'm trying to piece my various experiments into actual games.  I've got to start writing if I'm going to get them done this year....

    And all this time, my guitar sits in the corner crying (or gently weeping as the song goes).  Don't get me started on the piano.  About all I've done is screw around with it for a couple days.

    So, time for a round up...

    MONTH ONE: COMPLETE
    Japanese - 3/4 of the way through Level 1 of 3
    This is pretty great when you look at how much time is left, but terrible when you consider most of that progress was done last year. :/


    Guitar - Learned a bunch of easy songs (none of the ones from my books though)
    I made a ton of progress on the guitar.  I need to focus on my goals (one song a month from my chords books) though, in order to better measure my progress.  Still, I think I'm doing fine on this one.


    Programming - lots of exploration, but only some code snippets to show for it
    Again, I'm looking at my written goals and realizing I need to be making my way through the programming books I've got, and I need to be busting out some games (one a month again...).  I think this weekend will be spent trying to make the fastest, simplest game I've ever made in my life.  Start to finish.  At least then I'll have a base from which to work.


    Piano - zilch
    Alright, obviously, this took a backseat this month.  Next month though, it'll be time to hit the books.  I need to just incorporate it into my routine.  I'll get there....

    Beyond that, I still need to check out Improv classes and get in better shape (two goals I haven't included because they don't really have trackable progress that I can share here).  I've got the "getting into shape" part down though.  I've been playing dodgeball and dancing my way through Dance Central.


    My Grade: Not Bad

    Not great, but not bad.  Time to redouble my efforts and get going this next month.

    How's everyone out there in internet land doing?  Has your first month of the year been productive?

    Friday, January 21, 2011

    It all keeps adding up, I think I'm cracking up...

    Informally, I'm attempting to update this at least once a week.  Reminding myself that I need to post a blog reminds me that I need to be doing the things that I would be posting a blog about.  It seems, however, that as soon as you set goals, the universe goes about conspiring to keep you from completing them.  Thus, in my attempts to fight it, I am up now, at 4a.m., studying Japanese and writing a blog.

    おはようございます!
    わたしはblogをかいています。

    I wish someone who can read Japanese was reading my blog so that they could correct me if I'm wrong.

    Anyway, this week has been good for programming, not so good for everything else.  I'm learning a lot about the languages in which I make games but not making games.  I need to get on that if I'm going to get done what I hope to this year.  That being said tomorrow (today) is a hack day at work, so making a game there counts, right?

    Hopefully, this is just me being slow to start, and I'll ramp up shortly.  I need to be studying Japanese every single day because every time I have a short break, I feel like I'm losing something.  It makes me think I should do every thing (piano, guitar, Japanese, programming) once a day, but that's not really plausible.  I would spend more time switching activities and setting them up than I would actually doing any learning.

    I guess that's the hardest part.  I've committed to doing these things, and I've set aside the time to do them.  Now, I just need to get over the fact that I'm not going to progress at all of them everyday.  I have a year to accomplish these goals.  I just need to pace myself.

    Oh, and stop procrasting (Jake and Amir say "Hello").

    Saturday, January 8, 2011

    I know I'm gonna be...

    I'm gonna be the man who accomplishes all my goals...

    Sorry, I've got the Proclaimers running through my head.

    I learned it on the guitar because it's stupid easy, and it's fun attempting to imitate their voices (accents and all).

    I've also been trying to learn about writing music and was reminded of one of my favorite videos by this site.  That inspired me to learn the chords from Pachelbell's Canon in D Major, which is awesome because it reminds me of many great songs, and it's helping me with my transitions in and out of barre chords.

    I have realized, however, that the guitar has an unfair advantage when it comes to hobbies I'm pursuing.  It is by far the easiest to pick up and practice, requiring almost no preparation, and it's always in my sight because there are two sitting in my room.  Also, music strikes a chord (PUN!) that all my other hobbies don't.  If I'm not careful, I'll spend the entire year playing guitar and think at the end, "now, wasn't there something else I meant to do?"

    That's why, as soon as I'm done typing this, I'm going to jump into some programming (after strumming a few notes of course...).

    Sunday, January 2, 2011

    The Best Around

    There's a classic song, stop me if you've heard it.  It goes:

    I want to be the very best,
    like no one ever was....
     To catch them is my real test,
    to train them is my cause!

    Pokemon!

    It was a great song for a great show about a great game.  And it never fails to inspire the kid in me to dream big, and that's what I'm doing now.

    My dream is to do four things: play the guitar really well, play the piano really well, speak Japanese really well, and make great games.

    And that brings me to this page.  My hope is that maintaining this blog will keep me honest.  It will also be an outlet for me to display my progress, so that I don't get annoyed with toiling away in obscurity (even though I know no one is likely to read this, at least I'll feel like someone could be).

    I also plan on posting my various problems (and hopefully solutions), so that those on similar journeys will know that they're not alone.

    So let's begin...

    Come with me the time is right,
    There's no better team.
    Arm in arm, we'll win the fight,
    It's always been our dream!