Tuesday, November 18, 2014

Adventures in Web Development: Grousing at Git



Abstract:

If you're in a situation where you want to use an IDE to work on a Git project hosted on an enterprise version of GitHub, EGit will save you a lot of headaches. 

The long version:

An exciting part of my new role is assisting my team adopt Git as our version control solution. I have very little experience with it and have been wanting to learn it for years. Everything I read and heard about it gave me the impression that it's an easy-to-use yet powerful tool (plus all of the cool kids use it). Why wouldn't I want to use it too?

My team is in the process of transitioning from a strictly server-side development environment to a hybrid of client-server development. To do this, we're setting up project directories on our dev server and mounting those directories on our workstations as extra drives using sshfs. This allows us to develop with IDEs and other tools while still being able to see our changes immediately.  Granted, vim and emacs have their charm but I'll take a GUI over memorizing cryptic shortcut commands any day.

A nice feature of most popular IDEs is integration with a version control system like Git. My current IDE of choice is Aptana (emphasis on current) since it's free and seems to have decent syntax support for web languages. Aptana comes with Portable Git which is a lightweight version of Git. I assumed this would be all I needed, but boy was I wrong.

When trying to clone a repository from GitHub enterprise, I got an error saying "Bad credentials". I was sure that I put in the right information so I was very confused.



I thought perhaps I had to point the URI to my repository for the validation test, but that didn't work. Then I tried alterations of my username, adding in the domain. No luck. The Git options in Aptana were less than helpful too. After some research, I came to the conclusion that Aptana's Git plugin just assumes that any repository you want to work with is on github.com. There appears to be no support for working with GitHub enterprise repositories.Very frustrating.

Next I tried GitHub's desktop client because a coworker got it to work in his OS X environment without a hitch. After I put in my information, I saw my repositories show up. This looked promising since the client was actually able to authenticate with the enterprise account. I selected one of my repositories in the "clone" menu and hit the go button. The transfer seemed to be working until the progress bar reach halfway and hit an error. I knew the client was able to reach my repository so I was doubly confused.



After failing with two GUIs, I figured that Portable Git's Bash wouldn't let me down. I tried cloning the repository onto my network dev directory using Git Bash. This actually worked, but trying to stage changes resulted in a similar credentials error.

At this point I knew my problem wasn't a random bug. I dug into the logs for each of these three situations and found a similar symptom: "insufficient permission for adding an object to repository database .git/objects". Answers on the Web said to change permissions on the objects directory to give my workstation user read/write access. The problem was that my user didn't have privileges to change that access. It seemed that I was at an impasse.

Then, I found out about the EGit plugin for Aptana and figured it wouldn't hurt to give it a shot. After installing it, I was surprised to see that I was able to clone a repository, make changes and push them to my remote repository flawlessly. If only I had tried it to begin with!

My coworker tweeted Aptana asking why enterprise repositories aren't supported and got the response "I would expect GitHub would provide support through the EGit plugin." This make me wonder why the EGit plugin is not included by default or at least clearly referenced in the help docs? This would have saved me a lot of wasted time.

Monday, November 10, 2014

Pondering a Pond



Having been in a new role for three weeks, I am starting to sorely miss being able to regularly enjoy a stroll through nature. For over two years, I had the privilege of working at an office that was right next to a park with a walking trail going around the pond pictured above. I used to have the pleasure of seeing views like that one every day. It was a refreshing escape from the stress that came from the day-to-day task juggling. With music flowing into my ears, walking that trail gave my mind some space to daydream.

Now I work in a basement office without windows, which is a bit of a shock. I can still take mental breaks outside when I need some fresh air, but now that the snow is flying, I won't be doing that for quite a while.

Leaving that trail feels like leaving a part of myself behind. To me it represented a place to breathe, think and explore. It was always there when I needed it and I never regretted taking a walk around it. I hope to find a similar place by my current place of work. The snow just started flying today, so it's going to be a long winter.   

Saturday, September 20, 2014

Adventures in Web Development: Getting Started with node.js

After being a Web Dev for over 3 years now and still using primarily procedural coding techniques, I'm feeling pretty behind the curve. I've never felt good about my skills but it's become apparent that I won't get better unless I put in the effort to do something about it. To help with this, I'll be digging into some of the current tools of the trade to put together some neat hobby projects.

Arguably one of the biggest must-have tools to come out in recent years is node.js. It's non-blocking I/O model has been proven to save a lot of network resources and to improve application scalability.

I wanted to start my first project with Bootstrap. Bower is a really easy way to pull in all of the Bootstrap files into my project folder. To get Bower, I needed node.js for its npm package manager.

I'm using Kubuntu for my dev environment but this tutorial could apply to any ubuntu-based distro. The steps below were heavily inspired by this blog post.

1) Get Compiler
To use node.js, we need to be able to compile it from source. A compiler is available from the "build-essential" package. 

Update your packages and then install the "build-essential" package:
sudo apt-get update 
sudo apt-get install build-essential -y
 
2) Get Git
Installing Git is a simple command:
sudo apt-get install git -y 

3) Get Python and libssl
node.js depends on Python 2 which is available via the packages:
sudo apt-get install python -y
 
If you want to use TLS/SSL encryption, you will also need libssl:
sudo apt-get install libssl-dev -y
 
4) Get node.js!
At last we can install node.js. Be sure to check the current version on their site before continuing. First we'll use Git to clone the GitHub repository for node.js onto our system. We'll put it in /usr/local/bin to make it globally available for the user.

cd /usr/local/src
sudo git clone git://github.com/joyent/node.git
 
Now go into the cloned repository and check out the latest version (replace the letters after 'v' with the version numbers):
 
cd node
sudo git checkout vX.Y.Z 

With the version checked out, we need to configure it to make sure we have the dependencies installed:
sudo ./configure
 
Everything should report OK. If not, check any dependencies you're missing.
At this point, we have all of the resources we need to compile and install node.js:
sudo make
sudo make install 

Finally, node.js is installed! You can check it in the command-line by doing a quick version check which will return the version number you just installed:
node -v

Friday, August 1, 2014

Identity


David Lamb was a joyful man of many talents. He loved to tell jokes to lighten up a room, sing and strum a guitar to lift heavy spirits, go on a boating adventure to reel in elusive fish and carve wooden mementos that would last for generations. Having earned diplomas in industrial arts and engineering from three universities, he also enjoyed sharing his knowledge. He was always active, never slowing down if he could help it. His love of activities was almost as great as the love he had for his family.

Last Wednesday, the only grandfather I knew as a child slipped away quietly, leaving this legacy behind him.

As I reflect on the time I spent with him, I think about things he shared with me that I didn't think much of at the time. Despite me not being much of an outdoors kid, he was eager to take me out on his pier and cast a line just so I could experience the challenge of getting a catch. Later on, he gave me a tackle box filled with lures and other fishing bits so I could be a fisherman like him. Even though that box ended up on a shelf in my parents' garage, it still holds the kindness he showed me on the day he passed it on to me. I was also not much of a singer but that didn't matter to him. Occasionally when he had his karaoke studio playing some of his favorite country hits, he pulled me in for backup vocals. I bristled at first, but as I sang with him, I let go of my embarrassment and enjoyed the music. 

If there is one thing to take away from these memories, it's that in everything he did, my grandfather always stayed true to himself. He didn't care what other people thought because he knew what he stood for. That's something he left that I'll carry with me for the rest of my days. I've tried to be like others, thinking that things like drawings done by my hand or stories fabricated from my mind would somehow make me feel more fulfilled. The truth is that I was just faking an identity instead of appreciating my true one. I believe my grandfather realized this about himself and that's why he lived with such passion. I will go forward remembering this and looking forward to seeing him again in heaven.