Dictionary

It isn’t until recently that I have learned the value of words. I found myself frequently disregarding many words because I thought they were of little value to me.

Specific names to problems, laws, programming design patterns, etc. are all just “Words, words, words” to me. I don’t care what they’re called; I want to understand the idea behind them. I want to know what polymorphism is – and I don’t care what you call it. Discarding this type of information can save brain-space, but it has a fatal flaw:

It’s not all about you!

I read an article once (the name of which I have ironically discarded) that said the age of the individual invention is over. Gone are the days that a single person will stumble across a new element, or invent a new fuel source. These days, inventions are not the product of a eureka moment – but the product of teams of scientists and/or engineers spending countless hours trying to solve a problem.

What does this have to words? Communication.

The more words you use, the less value each one has.

It doesn’t matter how much you know if you cannot, intelligently, communicate with others. I would sound insane if I described things without using any sort of vocabulary.

With vocabulary: Have you considered iterating through the items?

Without vocabulary: You know that thing that lets you do the same thing many times to many of the same thing? Have you tried using that thing?

Vocabulary is a wonderful thing. Vocabulary is the difference between having to implement a sort function in C and using MyArray.Sort(); in C#.

Take the time to learn the vocabulary with the subject matter. It will make it easier for you to communicate with others, and for them to communicate with you.

P.S. – Don’t use big words just to sound smart.

P.P.S – Don’t belittle people who don’t know the words.

P.P.P.S – Remember, it is possible to understand something without knowing what it is called.

I needed another linux server …

I needed to test some new hardware to stay up to date …

I wanted to play with a new toy and I may be traveling soon, so it has to be compact. I decided on the Intel® NUC Kit D54250WYKH and ordered the parts off Newegg (instead of Amazon because Newegg was $50 less due to taxes).

First off, Kudos to Intel on the unboxing experience:

Now I have a compact, i5 based machine with an SSD and 16 GB of RAM. I’ve used VirtualBox in the past and recently I’ve been playing with clouds like Azure and EC2. So, why not make my own little cloud with this shiny new box? This way I don’t have to worry about shutting down my virtualized servers when I want to run to a coffee shop with my laptop.

I wanted to expand my knowledge on the topic, so I looked into some more heavy-duty Hypervisors like: Xen, ESXi, and Hyper-V. It was a long weekend with lots of pain, tweaking, and it resulted in some realizations.

The two criteria that ultimately made the decision were: I need to be mobile and may have to rely on wireless, and I’d also like to use this box as an HTPC to play the occasional movie on my TV.

Xen

I’ve left this purposely vague, because it requires a bit of explanation. In short, Xen is still going through some changes involving Citrix’s proprietary version (XenServer), XenServer.Org, XenProject, and XAPI. The short of it is that Citrix’s XenServer has a great GUI management tool (XenCenter). I was really hoping for a GUI since this is just for my home lab.

Here’s the problem: I need to be mobile and may need to rely on wireless. The version of Linux used by Citrix’s XenServer uses a kernel that is too old to support my wireless card. I was able to install the XenProject’s version of XenServer on a newer Linux distro, but this doesn’t have a GUI management interface by default. On top of this, there is currently some shifting going on between the tool stacks used to admin Xen through the command line.

This only covers the wireless part, now what about connecting to a TV? Xen actually seems to have good support for this type of pass-through, but I wasn’t able to get this far. Long story short, Xen left me feeling like I was in a store that was doing some serious remodeling.

Hyper-V

I started out with Hyper-V Server which is a stripped down version of Windows Server running only Hyper-V. The issue with Hyper-V is that it doesn’t come with a GUI to administer it on the server itself; you have to connect remotely. What’s more, it doesn’t have any wireless capabilities built in. I can attest that installing drivers and the wireless services in the Server Core environment is no picnic, but it is doable. Next, it turns out that remotely controlling Hyper-V (pretty much) requires a Domain to be set up. Again, this is getting beyond the complexity of what I want for an initial home lab. I tried Windows Server 2012 + Hyper-V and the results were about the same

Though, I am happy to report that Hyper-V Server took under 500 MB of RAM and had little CPU overhead. The Windows Server 2012 + Hyper-V had similar requirements, which I was pleasantly surprised by.

The Choice

The weekend was nearing the end, and even though I knew after Xen that I would probably not be able to use any of the enterprise-grade Hypervisors for my home lab. On the bright side, I was able to play with an unused box to get a taste for them.

My ultimate decision was that if I wanted to be able to do HTPC and Virtualization with WiFi support, I’d probably be stuck with VMware Workstation or VirtualBox on a Linux host machine. A bit of research showed that both of these products seem to have closed the performance gap when compared to the Type 1 (bare metal) Hypervisors. Furthermore, VirtualBox seems to have closed some of the performance gap with VMware – one article I read showed only a ~10% difference in a few benchmarks.

So, I decided to use VirtualBox for now – and if I really need some extra features and performance I can pay to switch to VMware later.

Remember I said I wanted a nice GUI? Enter phpVirtualBox. This gets me closer to running a headless virtualization server because it’s SUCH a nice web interface.

End Result:

Here’s a screenshot of phpVirtualBox on my NUC with Xubuntu as the host OS, a Windows Server 2012 VM with IIS and an Ubuntu 14 LAMP server. All of that packed into this tiny box, and using less than 4GB of RAM!

NUC Picture

phpVirtualBox

 

I think I’ll be giving Xen another try someday.

Like e-mails, blog posts should not be written while angry. Because my career isn’t on the line here, I’ll go ahead and break that rule.

It all started when I began working with two developers (Mike and Tiffany) on some projects.

 

The problem?

They use Git, I use Mercurial.

After doing a lot of research comparing Git and Mercurial, I decided to just go with Git.

In total, I’ve spent about 20-30 minutes of my life learning and figuring out issues with Mercurial.

In the last few weeks, I’ve spent at least 2-3 hours with Git because it has been a hassle each time I need to pull updated from the origin, or push my changes.

These were all simply annoying until the fateful evening of 9/16/2014.

 

The horror

I had done a few hours of work over a few nights trying to work out some bugs, and I finally went to commit because the bugs were gone. I committed, and went to bed.

(Note: Some people will argue that you should commit every hour or two, it’s a VERSION control system, I don’t believe in saving half-working code because I’m going on a lunch break)

Tonight, I launched my solution file in Visual Studio only to find out that my projects weren’t loading. “That’s strange”, I thought. Then I proceeded to look inside the project directory and gaze upon the bareness in shock. It was gone, all gone. Somehow, only a few of the publishing directories and my SLN file were left intact.

 

The real lesson

Now, I’m sure at this point the Git afficianados reading this are on the edge of their seats screaming “YOU PROBABLY RAN … COMMAND! IT’S YOUR FAULT!”

Ok, I’ll take the blame. I could learn more about Git. I could also spend time doing a lot of things instead of writing code like I want to. Refer to my figures before – I’ve spent about 20-30 minutes reading Mercurial documentation and have not had a single catastrophic failure like this in 2 years. I’ve spent far more time than that on Git, and in less than a month I’ve had a catastrophic failure.

The lesson? Use what works for you! Maybe I’m just not wired in a way for Git to make sense, that’s OK, because Mercurial does.

So, don’t worry about what the “cool kids” say is the best Version Control System – just make sure you’re managing your code in a way that works for you.

The moment this happened, I couldn’t help but remember one of the posts I read while researching this. Here is an excerpt from a Stack Overflow answer to the question “Is there any harmful commands  using Git and HG” :

In short:

  • Mercurial is safe by default, but adding chainsaws can completely break it.
  • Git is built out of chainsaws from the ground up, increasing apparent danger, but there are safeties.

 

The solution

Some of you may be wondering what I did to solve this issue. I spent a bit of time trying to figure out what I would do as well. Then it hit me. I think I’ve written a blog post about this before…

I have my Backblaze set to automatically back up my files. I just had to log into the website, go back to last night at 11 PM and download a copy of the project folder. I got my 200 MB backup of the folder in less than 20 minutes. This service just paid for itself for the next year!

backblaze_restore

 

Great news! I’ve been accepted into ADN! It’s amazing how overwhelming the possibilities are. I have access to all the software and the ideas just keep coming. I don’t know where to start, to be honest. I’m sure I’ll do something soon though. I’m still waiting to hear back from Microsoft about BizSpark though. Worst case – I can get started with Visual Studio Express.

I’m looking to get a jump-start on this whole post-college, world-exploring, idea-generating mayhem. I’ve found a few programs (which I’ve applied for) that should help me along the way. Microsoft has a thing called BizSpark for start-ups to get free access to MSDN. This is similar to DreamSpark for students. I’m eager to find out the results of this application.

Next, I’ve also applied to the Autodesk Developer Network (ADN) . Hopefully, this will give me access to Autodesk products and their APIs to work on custom plugins and different integration techniques.

What’s my goal? To learn! I want to have all the resources necessary to be able to develop and publish all these ideas and concepts I come up with. Will I sell (m)any of them? Who knows, but that’s not the point for right now. I’m eager to find out if I get approved, hopefully at a reduced cost for the ADN membership. It seems like a win-win to me. I get to learn, Microsoft and Autodesk get free advertising for their products, and hopefully other people will get benefit out of what I write – both in code and blogs!

So you’ve been using JIRA, it’s going well – and now you want to move away from the default internal directory or the built-in LDAP support. This may be because you’ve outgrown it, because you want easier sign-on, or because there’s been a shift in the environment that you’re supporting. No matter what, you’re about to go on a ride.

JIRA supports Seraph authentication – both are from Atlassian. The great thing about this is it will allow you to write your own authenticator class in Java. The bad part about this is it’s very poorly documented.

Your first search will probably land you here: https://docs.atlassian.com/atlassian-seraph/latest/sso.html

At the time of this writing, that article is over a year old and it doesn’t get you quite where you need to go. Furthermore, it doesn’t even tell you where to get started.

As you search around more, you’ll find various Confluence articles at Atlassian, a few GitHub projects, and some questions on answers.atlassian.com. I’m going to try to save you some of the effort by giving the details of what I did to get an authenticator up and running.

As a note – my environement is Windows based so your steps may vary accordingly.

Here’s a brief overview:

  1. Download the SDK: https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project
  2. Don’t worry about getting the Eclipse editor – you can get by with a simple editor like Notepad++ for this.
  3. After you’ve installed the Atlassian SDK, don’t use it for anything but building!

I saw a few different (misleading) posts on how to build the authenticator. The bottom line is that using atlas-create-jira-plugin command doesn’t work, and nor does atlas-create-jira-plugin-module.

It seems that this authenticator is some strange mix in-between. It’s a type 1 plugin which means it has to be “installed” (copied) into the WEB-INF/lib

Let’s get started…

The first thing the documentation tells you to do is implement the com.atlassian.seraph.auth.DefaultAuthenticator; class. I’ve found this to have issues, and had much better success with: com.atlassian.jira.security.login.JiraSeraphAuthenticator.

See my BitBucket project for my quick implementation of this class with very limited features: https://bitbucket.org/docsaintly/jira-sso-with-siteminder.

From here, you just have to implement: public Principal getUser(HttpServletRequest request, HttpServletResponse response)

This function returns a Principal object which is basically just the username of the person who is authenticated. You can use the super.getUser(request,response) to do this for you without much work.

The rest is up to you and how you want to choose what to do. As you can see in my implementation, I look for the variable “username” in my header that I’ve been passed from SiteMinder. If you use a different variable, just change this.

From here, I have to strip off the domain name that is passed along with the username. I could have also retrieved the cookie itself because that contains the username without the domain. It’s all up to you what you want to do. You can find other examples online that go as far as to automatically create new users in the system after they’ve been authenticated through the SSO. This is where you get to determine how it figures out which user in JIRA gets mapped to the user coming from the SSO.

Once you have your code written, you can drop into the command prompt and run atlas-package assuming you have the Atlassian SDK installed.

This will alert you of any errors, and once it is successful you can copy your compiled .jar file to the WEB-INF/lib folder of your JIRA installation.

The one thing left to do is configure your seraph-config.xml file according to Atlassian’s SSO documentation to configure where the login and logout of Seraph will point.

After you’ve done all this, restart your JIRA instance and watch the atlassian-jira.log as it starts up to see if your authenticator loaded properly.

There are a few other things I’ve done that weren’t documented, but I haven’t confirmed if they are necessary.

With the way I’ve written the authenticator, if you authenticate through SiteMinder and land on the system but don’t have an account – you’ll be faced with the login page. You probably don’t want this – so you’ll want to disable the login gadget in the jpm.xml file according to this post: https://answers.atlassian.com/questions/296109/disable-jira-login-page-with-seraph-sso

The final thing is to set up some filters in Tomcat’s web.xml file to point certain activities towards Seraph’s Login and Security pages. This is the part I know the least about and will do more investigation on:

<!-- Seraph Filters for SiteMinder SSO -->
<filter>
<filter-name>login</filter-name>
<filter-class>com.atlassian.seraph.filter.LoginFilter</filter-class>
</filter>

<filter>
<filter-name>security</filter-name>
<filter-class>com.atlassian.seraph.filter.SecurityFilter</filter-class>
</filter>

<!-- Seraph Filter Mapping for SiteMinder SSO -->
<filter-mapping>
<filter-name>login</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>security</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Credits for this post go to MANY people who have provided snippets of code and help for a portion of JIRA/Seraph that is very poorly documented. I will try to add more credits as I polish this article.