Apache Maven & Homebrew

The OK-HTTP project lists that I can compile this project using Maven.  The Maven project is a build tool for (primarily) Java projects.  It provides a dependency list of other bits of compiled code and pointers to how to fetch them for a compile.  There is an alternative tool called gradle, but I’m not going to delve into that that.  I’d love to learn it at some point but I’ll stick with Maven.

Let’s check and see if I’m running Maven already: 

mv --version

.  I get an error back that signifies that I’m not running it on my local machine.  Ok, very well let’s go grab it. This seems like a good time to mention Homebrew, an package manager for OSX.  The description of Homebrew on the official site is that it gives you all the programs and tools that Apple took out of of OSX.  It is command line based, and it’s a quick scripting engine to find common projects and libraries and compile them and any dependencies they may have.  Its very straightforward to install, and you can query it for formula (read: software packages) that they have by running:

brew search maven
brew install maven

 At the end you’ll have a version of Maven installed in your “cellar” under “/usr/local/Cellar/…”  The idea is that programs compiled or installed by Homebrew shouldn’t interfere with a possible prior installed version in the normal “/usr/local/…” directory.  In this way there’s no real conflict if some other app also happens to install maven in the default directory.

Alright, so first up I’ll rerun the “mvn –version” command.  This tells me that unfortunately the version of Java it found on my $PATH is the default Apple provided version, JDK 1.6.**.  That’s definitely not very useful because the OK-HTTP project requires compiling against Java 7, and even I’m running the latest sub-version of Java 8.  Apparently this is common enough that someone has written a shell script to solve this here.  It looks legit, and I’ll tweak it to look for Java 1.8.  Success!  Here is the result of Maven now reporting the correct version:Switch JDK Version

Alright, clone the project and let’s see what we’ve got here.  I’ve followed the “Get up and running with Maven in 5 minutes” tutorial here, which gave me everything I needed (I think).  I created a Maven “goal” to create a stubby simple HelloWorld app.  This gives you a nice organizational tree and a basic JUnit test for that same basic Java class.  It also creates a pom.xml file which is how Maven configures your project.  It’s actually relatively simple– there is a key called “dependencies” and that’s where you can specify that during a build/compile phase of your project, that it reach out and grab a specific version (or the newest) of a JAR to compile your code with.  This makes it really easy for us to add the Ok-HTTP code as a dependency to the project with just a few lines.

Here’s the code I added to my pom.xml file: 

<dependency>
  <groupId>com.squareup.okhttp</groupId>
  <artifactId>okhttp</artifactId>
  <version>2.1.0</version>
</dependency>

Once there, I asked Maven to go compile my project once again using “mvn compile”, which gave me a successful compilation and the following result:OK-HTTP Maven

I’m now feeling pretty good with the basics of Maven.  If I was to use this in a Java project I could start a project in Maven, do my normal source code, and compile and build against these references to someone else’s code.  I’m ok with that, but honestly (and don’t shoot me), I do most of my Java code in the Eclipse IDE.  Considering this whole project structure that Maven implemented is still different than the Eclipse project structure, (which is in itself different than the Git blob structure) I’ve got some more work ahead of me.

Contributing to Open Source

Contributing to Open Source

Well, another quarter is behind me.  I have like 2 weeks to try and decompress and get ready for the new quarter. I’m not sure if anyone truly decompresses from this stuff though– I think part of me is afraid to let it all go because its definitely the meaty stuff that shows up in a technical interview.  As a way of “relieving the pressure” so to speak, I’m going to try and improve my standing on GitHub today.  As CS undergrads we constantly hear that we should be contributing to open source projects, and to show off your GitHub profile when talking with prospective employers.  So today I’m going to try just that.

The irony is that there are a ton of articles online about “How to get started with open source” and they mostly involve working with a project you’re already using or are interested in.  Unfortunately for better or worse, most of my college career hasn’t been spent using third party libraries or consuming other people’s code, at least not on the surface. I am well aware that right underneath the surface of my OS there is a world of open source libraries and functionality.  My intent is to write about what I come across as I attempt to do something simple like “contribute to open source”.

The basics: Here is my GitHub profile page:

Those squares should be green....

Those squares should be green….

It’s beautiful isn’t it? I’ve got a streak of pushing code to a repo of 1 single day. Ha!  Let’s change that.  GitHub suggests you search or explore the site by specifying a language.  I’ve spent the last 2 years in Java and I’d rather not be thrown a curve-ball today.  Looks like Square has a project called Ok-HTTP which handles HTTP requests via SPDY.  SPDY‘s goal is apparently to reduce web page load time and optimization over the HTTP interface.  Ok, sounds simple enough.  Who doesn’t want to make web connections faster?

I think my peers would say my “git-fu”, i.e. the amount of skill I have using Git is probably fairly high.  I can definitely grok the command line stuff, but I prefer to use the implementations within Eclipse or even Atlassian’s excellent SourceTree application.  I can either grab this thing as a pre-packaged Java JAR (compiled obviously) or I can grab the source through something called Maven.  Hmm…Looks like thats the first place I need to go.

GitHub For Students Pack

GitHub For Students Pack

Normally my favorite site for repos is BitBucket vs GitHub but this week they announced something really nifty that seems very useful for students, or anyone really working with tools to ease software development.  It’s called the GitHub Education Pack, and it can be found here.  Once you verify your student account, they give you a lot of free or reduced fee access to a variety of services.  Some of these are completely useless to me (right now anyway), but a few standouts that I’m already using:

  • GitHub
    • It may sound stupid but I primarily signed up through BitBucket because they give you unlimited private repositories.  Not all of my code is meant for the world to see, but I like getting in the workflow of branching, staging and committing code even if its only to a repo I work with.  The student pack offers some private repos for free, and access to the GitHub API.
  • Orchestrate
    • Their tag says “databases as a service” but it is so much more than that. It’s simple key/value pairing in a REST API, and since it already exists and is free I’ll probably be leveraging it in some way.
  • Travis CI
    • Continuous Integration is a hallmark of open-source and team collaborative projects.  CI ensures that as code is committed, it’s automatically built and ran against a series of unit tests residing in the cloud.  From there, notifications can kick off to the team informing them of successes or failures and to take the appropriate action.

The other bits of the tools I’m not really using at this point but that’s because I have my own VPS and infrastructure located elsewhere.  For folks that don’t, the rest of these tools would be an excellent starting place.

Back into Objective-C

Trying something new this month– I’m going to try and write a post a day which should be challenging to say the least. I’ve let GA sit dormant for too long, and I’m doing some fun things that deserve to be noted about (if only for my reference).  First off, I’m buried in Objective-C again for the first time in a good long while.  iOS8 is about to be dropped shortly (few weeks) and I think the last time I built a functioning app for iOS was back on version 3; At that point they were still dubbing it an “SDK”.

I’ve been following an e-book that these guys put out, iOS Programming: The Big Nerd Ranch Guide which is rather neat I think.  It’s covering a lot of things about iOS7 that I never knew and is really making it easy to forget about all the crap I learned for dev on iOS3– manual reference counting, myriad hidden API’s and the like.  I’m having a blast doing it.

Anyhow, back to it!

Machine Organization – Game Boy Project /w Assembly

Machine Organization – Game Boy Project /w Assembly

Last quarter I took a Machine Organization class as part of my required studies at UW.  Machine Org deals with how computers (and other machines) translate between voltage changes coming in, to discrete 1’s and 0’s and finally towards maintaining state and running the software and other functions that are asked of them.  I like the class a lot, but completely hated the book (I’ll probably get around to reviewing that later).  The more I got entrenched in the minutiae, the more exciting it became.  I decided to try my hand at building a working Game Boy game in C and/or Assembly, and dumping it to a working cartridge to play on an actual console. (more…)

U-2 Caused Widespread Shutdown of US Flights Out of LAX

From the article:

“Reuters reports that last week’s computer glitch at a California air traffic control center that led officials to halt takeoffs at Los Angeles International Airport was caused by a U-2 spy plane still in use by the US military, passing through air space monitored by the Los Angeles Air Route Traffic Control Center that appears to have overloaded ERAM, a computer system at the center. According to NBC News, computers at the center began operations to prevent the U-2 from colliding with other aircraft, even though the U-2 was flying at an altitude of 60,000 feet and other airplanes passing through the region’s air space were miles below.”

One of the commenters on the post suggested the aircraft was flying VFR-on-Top, a set of rules governing how the ATC systems respond to potential collisions in airspace and warn aircraft (or operators) to move.  The system was only designed to respond effectively to aircraft using this specification below 18,000 feet, but the U-2 was flying at 60,000 ft.  Essentially every aircraft below that ceiling was “in the way” and the system overloaded attempting to parcel out commands to move those aircraft out the way.

(more…)

Azure based augment for gaming

Azure based augment for gaming

Here is a link to a Kotaku article about Microsoft augmenting a future title using the power of Windows Cloud (or Azure, or whatever they’re calling it these days).  I can only imagine that one of the sweeter deals of being an Xbox One developer is that you’ve got access to some of these services backed by Microsoft.  I know the game Titanfall mentions making some use of this (here). By offloading CPU intensive tasks to the cloud and “streaming” that data back to the client requesting it, you free up the CPU and GPU for more intensive rendering tasks.

That has to be a huge win for Microsoft!  Utilizing such a cornerstone of the Microsoft infrastructure hurts, especially if there’s no equivalent on the Sony side to touch. Unfortunately, I find almost no mention of this on the Net, and navigating the Channel 9 MSDN video site is an exercise in pain.

Filing away to follow-up and dig up more.

Setting up for C

Setting up for C

My last experience in development in “true” C was at least 10+ years ago.  This quarter for my Machine Organization class we’re getting down and dirty with some basic C operations as we develop in Assembly and execute some operations on a virtual ISA.  After spending so much time Java, I underestimated how much time it would take to jockey around my workspace and preferred IDE, Eclipse to get into C.

For most of my time in Java I’ve developed with Eclipse as my IDE, using the latest Kepler release after transitioning from Juno the previous year.  I find myself in the minority of people who like Eclipse, though I’m not doing most of the advanced visual things (Android dev for example) that either Android Studio, IntelliJ, or NetBeans really excel at.  At the end of setting up everything for C, I realized that I have a ton of preferences tweaked and set just so in the app.  Attempting to duplicate this across my two dev machines was a bit annoying but not insurmountable.

(more…)

Can Xbox One Be a Trojan Horse to Lure Developers? | Re/code

Can Xbox One Be a Trojan Horse to Lure Developers? | Re/code

Microsoft disclosed Wednesday that it plans to make it possible for developers to write a single program that can work across Windows, Windows Phone and, yes, the Xbox [One].

Dig it.  Can I predict another Microsoft purchase?  They’ll buy Xamarin which makes a great set of tools that integrate with Visual Studio to allow you to truly target one API and make it run on multiple devices.  My only gripe will be if they limit individual functionality on a per-device basis.

Can Xbox One Be a Trojan Horse to Lure Developers? | Re/code.

 

 

Effective Java (2nd Ed.)

Effective Java (2nd Ed.)

As a Computer Science student, I think we’re expected to hold a very large library of books.  Some are required textbooks for classes, and others are indispensable bundles of text that we just happen or or passed through the grapevine.  For me, this book is the former.  Effective Java by Joshua Bloch is one of the most indispensable textbooks I’ve ever read on the Java language. (more…)