<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[musings between the lines]]></title>
  <link href="http://subdigit.com/atom.xml" rel="self"/>
  <link href="http://subdigit.com/"/>
  <updated>2015-02-12T14:43:31-08:00</updated>
  <id>http://subdigit.com/</id>
  <author>
    <name><![CDATA[subdigit]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[cracked]]></title>
    <link href="http://subdigit.com/blog/cracked/"/>
    <updated>2015-02-12T12:43:00-08:00</updated>
    <id>http://subdigit.com/blog/cracked</id>
    <content type="html"><![CDATA[<h3>It was bound to happen&#8230;</h3>

<p><a class="gallery" rel="cracked" href="https://lh5.googleusercontent.com/-ysRXQoC9wpw/VN0n7laJFSI/AAAAAAAAKMM/DIZJu-jyG_I/s800/DSC_6418.JPG" title="Cracked!"><img class="left" src="https://lh5.googleusercontent.com/-ysRXQoC9wpw/VN0n7laJFSI/AAAAAAAAKMM/DIZJu-jyG_I/s300/DSC_6418.JPG" width="300" alt=""/></a></p>

<p>Sooner or later, it&#8217;s going to happen.  No matter how careful, no matter how diligent, you&#8217;re going to drop your phone.  And it&#8217;s going to crack the screen.  More so with these new phones, like my Moto X, which are just screaming to be carried unadorned by a case because it&#8217;s just so nice to see (yes, I guess I could have gotten a bumper style protector for it).</p>

<p>So I dropped my Moto X, and it managed to both crack the screen and render the touch interface useless.  That put me in a pickle since most solutions I saw were for mirroring your phone to your computer but still assuming your phone had retained its touch capabilities.  I had lost both.</p>

<p>So here&#8217;s what I had to do to recover from that.  But first, if your <strong>Android</strong> phone is in a situation where it could be damaged (cough, that subtly means <em>everyone</em>), there are some simple steps to take <em>ahead of time</em> that will let you avoid detrimental failures of data access should your phone get damaged.</p>

<h3>Prepare: Enable USB Debugging</h3>

<p><a class="gallery" rel="cracked" href="https://lh5.googleusercontent.com/-YAn_pnRXIes/VN0n9X1mAoI/AAAAAAAAKMg/Yz69MTgt5ZA/s800/DSC_6422.JPG" title="Full view"><img class="right" src="https://lh5.googleusercontent.com/-YAn_pnRXIes/VN0n9X1mAoI/AAAAAAAAKMg/Yz69MTgt5ZA/s300/DSC_6422.JPG" width="300" alt=""/></a></p>

<p>This is perhaps the most crucial thing you can do for your Android phone to enable post-destruction data access.  This basically allows your phone to be accessed by your computer via USB cable.  This <em>has</em> to be enabled for quite a lot of the solutions out there for data access to work.  Do it now.  Do it as the first thing you do when you get your new Android phone.</p>

<p>Really.  DO IT NOW.</p>

<ul>
<li>Goto: Settings > About phone (this may differ based on you phone)</li>
<li>Touch &#8220;Build number&#8221; 7 times till you see &#8220;You are now a developer!&#8221; pop up.</li>
<li>Go back to: Settings</li>
<li>There should now be a &#8220;Developer Options&#8221; section.</li>
<li>Enter &#8220;Developer Options&#8221; and click &#8220;USB Debugging&#8221; checkbox under the &#8220;Debugging&#8221; section.</li>
</ul>


<p>Now a step often not mentioned:</p>

<ul>
<li>Go plug your phone into every machine you have and touch &#8220;Yes&#8221; when prompted about allowing this machine to access your phone.</li>
</ul>


<p>Tools change, and tools are written for specific platforms.  This simple act will make sure you can access your phone properly on any machine in the house.  Once again, if you do nothing else, <strong>DO THIS NOW</strong>.</p>

<h3>Recovery: Get your data out</h3>

<p><a class="gallery" rel="cracked" href="https://lh3.googleusercontent.com/-v8bceHJ77gk/VN0n9Z6-cFI/AAAAAAAAKMc/iZwwusS8Hdg/s800/DSC_6439.JPG" title="The old and the new"><img class="left" src="https://lh3.googleusercontent.com/-v8bceHJ77gk/VN0n9Z6-cFI/AAAAAAAAKMc/iZwwusS8Hdg/s300/DSC_6439.JPG" width="300" alt=""/></a></p>

<p>In my situation, I wasn&#8217;t as keen on performance as mere access.  I just wanted to get hold of my data and export it so that I can keep things like SMS messages and other items that just are not automatically backed up (why Google, why not?).  There are quite a number of solutions out there that will mirror your screen to your computer, but most of them relied on touch still working on your phone (mine was not) and often times if it did provide control, it was not at all done in a usable way (sorry <a href="https://github.com/ternes3/TouchControl-for-Android">Touch Control for Android</a>).</p>

<p>But I stumbled upon this gem by <a href="https://twitter.com/Musgit">Marian</a> <a href="https://plus.google.com/105260884951100799763">Schedenig</a>: <a href="http://marian.schedenig.name/2014/07/03/remote-control-your-android-phone-through-adb/">ADB Control</a></p>

<p>What&#8217;s nice and hacky about ADB Control is that it simply takes periodic screenshots of your screen, presents you with it, and listens for mouse and keyboard inputs.  Which means it&#8217;s slooooow, but it works and does everything you would do with normal touch control including swipes.  Nothing special needed, just switch from finger to mouse.</p>

<p>Once you have something like that working, you can use something like <a href="https://play.google.com/store/apps/details?id=com.koushikdutta.backup&amp;hl=en">Helium</a> to backup your data to your local machine (or the cloud or wherever you want).  You can even continue to use your phone &#8220;normally&#8221; to do things while you get your replacement phone (although it was a lifesaver to have Moto X&#8217;s voice actions still work).</p>

<h3>Addendum: Android backup/recovery is seriously fubar</h3>

<p>Despite having a recovery process in place, especially in Android 5.0, I&#8217;m still quite disturbed by how poorly it works.  Not only could I not get the Lollipop recovery process to recognizes any previous devices to recover from, when I tried the NFC data transfer, it really only partially worked.  Lots of apps were left off and it felt really immature.</p>

<p>Then there are things like <a href="http://forum.xda-developers.com/galaxy-nexus/general/guide-phone-backup-unlock-root-t1420351">adb backup</a> which seem to work great, except for a few things it cant backup (like SMS messages).  I was a bit confused by that (or maybe it was my incompetence at using the tool).  Either way, Google, if we use Gmail, we do have some space to leverage, why not just allow us to automatically snapshot <strong>everything</strong> periodically to somewhere like Google Drive so that we have <strong>everything</strong> backed up and ready to recover should we need to?  In the meantime, <a href="https://play.google.com/store/apps/details?id=com.koushikdutta.backup&amp;hl=en">Helium</a> can do that exact job, but I just wish it was part of the whole ecosystem so that when we activate a new device, we can make a full data recovery right as the device is being initialize.  And I mean <strong>full</strong>.  No need to fuss with any details.  Turn on new device.  Specify what image to back up from, and voila, completely functional new device based on old device data.  I feel like this is what the Lollipop on boarding process is <em>supposed</em> to do, but I just couldn&#8217;t get it to do that.</p>

<p>Anyway, for now, <strong>Helium</strong> is the way to go for data backup and recovery.  <strong>ADB Control</strong> is wonderful for giving you virtual access to a broken phone to make it completely usable, albeit no longer &#8220;mobile&#8221;.  It&#8217;s a small trade off.  These two should be enough to get you by while you get your phone replaced and are back up and running again.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[pediatric massive transfusion protocol]]></title>
    <link href="http://subdigit.com/blog/pediatric-massive-transfusion-protocol/"/>
    <updated>2014-10-21T10:00:00-07:00</updated>
    <id>http://subdigit.com/blog/pediatric-massive-transfusion-protocol</id>
    <content type="html"><![CDATA[<br />


<center style="font-size: 1.4em;"><strong><span style="border: 1px solid #ddd; padding: 20px; background: #eee;">Download <a href="http://subdigit.com/mtp">the latest version</a></span></strong></center>


<br />


<br />


<p><img class="left" src="https://lh5.googleusercontent.com/-t8vSLLLiAmk/VFKc0WBygbI/AAAAAAAAJQo/SejvCbH3_xk/w300/Pediatric%2BMassive%2BTransfusion%2BProtocol%2B-%2BClean.png" width="300" height="356" title="Pediatric Massive Transfusion Protocol v1.2" ></p>

<p>This is the second <a href="http://subdigit.com/blog/pediatric-preoperative-fasting-guidelines">medical handout</a> completed.</p>

<p>The task this time was to come up with a clearer simplification of the <a href="http://subdigit.com/mtp">Pediatric Massive Transfusion Protocol</a> used by medical staff to assess the need for various durg and blood volumes for their pediatric patients during surgery.</p>

<p>The handout is inspired off of a slide from &#8221;<a href="http://www.uwmedicine.org/referrals/documents/Johnston-Pedatric-Trauma.pdf">Issues in the Management of Pediatric Trauma</a>&#8221; by Brian D. Johnston, Chief of Pediatrics, Harborview Medical Center, which in turn is based on the data from <a href="http://www.sempedsurg.org/article/S1055-8586(10)00045-4/abstract">Dehmer et. al. <em>Seminars in Pediatric Surgery (2010) 19, 286-291</em></a>.</p>

<p>We picked a choice of font, colors, and various demarcations to help clearly convey information as would be appropriate for medical staff.  As such, appropriate lingo and abbreviations were left in and spaces were provided to account for the blood bank phone number and any contact information needed.  The idea is to have this sheet printed and laminated so that the information can be adjusted as needed.</p>

<p>Pertinent use of colors to indicate various severities and a checklist were provided to help staff easily recognize what they need to do at a quick glance.  Hopefully this will serve as a valuable quick-glance charting to spot the needed dosages and checklist accomplishments.</p>

<hr /><br />


<p>As always, you can download the PDF version of the handout on the <a href="http://subdigit.com/mtp">Pediatric Massive Transfusion Protocol page</a>.</p>

<p>Please feel free to let me know if you have any suggestions, or if something like this would be useful for your own use.  This project is licensed under <a href="http://creativecommons.org/licenses/by/4.0/">CC-BY</a> which simply means that you&#8217;re allowed to use it for your own purposes, and if needed, change anything on there to suit your needs.  An attribution back to the <a href="http://subdigit.com/mtp">Pediatric Massive Transfusion Protocol page</a> is appreciated, if only for the purposes of linking back for the latest information should the guidelines change in the future or if we do something new and improved.  But I&#8217;ll leave that part as a recommendation rather than a requirement.</p>

<p>If you need a ready-to-print version that instead uses your own institution or organization specific drug dosages, feel free to <a href="mailto:subdigit+mtpinquiry@gmail.com?subject=MTP%20Inquiry">contact me</a> and I&#8217;m sure we can work something out.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[pediatric preoperative fasting guidelines]]></title>
    <link href="http://subdigit.com/blog/pediatric-preoperative-fasting-guidelines/"/>
    <updated>2014-08-06T10:00:00-07:00</updated>
    <id>http://subdigit.com/blog/pediatric-preoperative-fasting-guidelines</id>
    <content type="html"><![CDATA[<p>Well, this is something different for a change.</p>

<br />


<center style="font-size: 1.4em;"><strong><span style="border: 1px solid #ddd; padding: 20px; background: #eee;">Download <a href="http://subdigit.com/npo">the latest version</a></span></strong></center>


<br />


<br />


<p><img class="left" src="https://lh4.googleusercontent.com/-ycJicarf43s/U-FoKliomxI/AAAAAAAAI2E/A7VDgfuCg5A/w300/Pediatric%2BPreoperative%2BFasting%2BGuidelines%2B-%2BChart%2B-%2BParents.png" width="300" height="394" title="Pediatric Preoperative Fasting Guidelines" ></p>

<p>I was tasked with coming up with a design to showcase the guidelines pediatric anesthesiologists set forth for their pediatric patients prior to their surgery or procedure.  Often medically referred to as the <abbr title="nil per os - nothing through the mouth">NPO</abbr> Guidelines, otherwise more colloquially know as the Pediatric Preoperative Fasting Guidelines, these guidelines outline the types of foods and liquids children can take, and the duration of time before surgery that makes it safe for them to eat and drink.</p>

<p>The goal is to balance the duration of time patients must have their stomachs empty for the sake of improving medical procedure safety and to still allow for proper nutrition and hydration prior to their procedure.  Needless to say, there are guidelines specifically laid out by the <a href="http://www.guideline.gov/content.aspx?id=39270">government</a>, various organizations (<a href="https://www.asahq.org/">ASA</a>, <a href="http://www.pedsanesthesia.org/">SPA</a>) and hospitals (<a href="https://hopkinschildrens.org/Pediatric-Fasting-Guidelines-for-Surgery.aspx">John&#8217;s Hopkins</a>, <a href="http://www.choc.org/surgery/index.cfm?id=P00749">Orange County</a>, to name a few).  Oddly, none of the guidelines are in any form strictly mandated (from a legal perspective).  That being said, there are commonly agreed upon time durations for various types of liquids and foods that parents need to be aware of prior to their child&#8217;s surgery or procedure.</p>

<p>The aim of this handout is to provide a visually compelling and easily comprehensible way for parents to determine what and when to feed their child, pre-hospital <em>arrival</em>.  We wanted to make this as simple as possible without an overt use of words and other language specific terms since we can receive caretakers from all walks of life.  But going completely languageless is a touch difficult, and probably impractical, so we went with just trying to be minimalist and to use iconography to help represent the different guidelines.</p>

<p>The result is a two page document meant as handout to be given to parents as part of their take home package.  The <a href="https://drive.google.com/uc?id=0B4ayg3mVVG1SdVM1WWRVeGNuWkk">1st page</a> shows the various timelines associated with the different food categories, such as liquids, milk, and meals.  Each timeline will feature a checkbox and time input field that the parents can use to fill in when they last fed their child that specific item.  The hope is that this will actively engage the parents in knowing what their child ate or drank, and give a heads up to the medical staff about the corresponding times, just to double check.</p>

<p>The <a href="https://drive.google.com/uc?id=0B4ayg3mVVG1SZ0FTS2V3ZXJsQ00">2nd page</a> features a table adding in examples of those food groups.  The list could be endless considering the number of food items there are, so it was just narrowed down to some specifics most likely for a child.</p>

<p>There is also a <a href="https://drive.google.com/uc?id=0B4ayg3mVVG1SWFFpZjR3cGdpVHc">2nd version of the 1st page</a> meant for the medical staff to use as reference for themselves.  The small change with this version is that there will be a sample name already filled in and the checkboxes and time input fields will be removed since they wont be necessary.</p>

<p>Hopefully this can be used as a simple reference to successfully comply with the NPO guidelines for both medical staff and parents prior to the surgery or procedure.</p>

<p>You can download the PDF version of the handouts on the <a href="http://subdigit.com/npo">Pediatric Preoperative Fasting Guidelines page</a>.</p>

<p>Please feel free to let me know if you have any suggestions, or if something like this would be useful for your own use.  This project is licensed under <a href="http://creativecommons.org/licenses/by/4.0/">CC-BY</a> which simply means that you&#8217;re allowed to use it for your own purposes, and if needed, change anything on there to suit your needs.  An attribution back to the <a href="http://subdigit.com/npo">Pediatric Preoperative Fasting Guidelines page</a> is appreciated, if only for the purposes of linking back for the latest information should the guidelines change in the future or if we do something new and improved.  But I&#8217;ll leave that part as a recommendation rather than a requirement.</p>

<p>If you need a ready-to-print version that instead uses your own institution or organization specific guidelines, feel free to <a href="mailto:subdigit+npoinquiry@gmail.com?subject=NPO%20Inquiry">contact me</a> and I&#8217;m sure we can work something out.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[project bootstrapping]]></title>
    <link href="http://subdigit.com/blog/project-bootstrapping/"/>
    <updated>2014-06-19T13:00:00-07:00</updated>
    <id>http://subdigit.com/blog/project-bootstrapping</id>
    <content type="html"><![CDATA[<p><img class="left" src="https://lh3.googleusercontent.com/-7dfl8zt4rJI/UPWxMzMYEJI/AAAAAAAAEMU/p1MDs4ZA2_s/s300/yeoman.png" width="212" height="300" title="Yeoman" ></p>

<p>The worst part about getting started with a project is that, well, you need to <em>actually get started</em>.  And that&#8217;s always easier said than done.  You have your ideas in your head about what it should be, and you have some inkling of the tools you want and where to start, but sometimes that initial setup and the technology choices that you need to make upfront are just a tad overwhelming, even with all of today&#8217;s tools and bootstrap kits.</p>

<p>So I thought I&#8217;d write myself a bootstrap outline that I can use to just get going.  The neat thing about this is since it uses <a href="http://yeoman.io">Yeoman</a>, I can just run it as I want with whatever options and technology depth I want and Yeoman can take care of the nitty gritty.  I just need to outline all the steps I need to take to get to the point where I can invoke Yeoman and then take care of the cleanup and preparation post Yeoman install.</p>

<p>Using something like Yeoman also means that I can try things out incrementally.  The first step might be to configure a project that allows me to just have a html workspace to frame out the site.  Once that&#8217;s done, I can then restart the project with a more interactive setup, perhaps like a single page application with <a href="https://angularjs.org/">AngularJS</a>.  After that, when I&#8217;m ready, I can hook in a backend and have a full fledged site.</p>

<p>This isn&#8217;t going to be a project starter pack like you might see on <a href="https://github.com/">GitHub</a> since I really wont know what I want to do yet.  All I want is something basic to sandbox in and just get experimenting so that perhaps I can grow it into something more significant, dump it and restart with some different tools, or just use it for what it is and play around.  Plus, making myself write out and execute each of the steps will help me improve my grasp on the various tools used in the process.</p>

<p>These are the step I have in place as needed for my projects on Ubuntu.  It&#8217;s still a work in progress so as I figure out new and better ways to do things, I&#8217;ll keep it updated.  Your steps may differ slightly depending on setup and platform, but hopefully not too much.</p>

<p>So here we go.</p>

<h2>Prepare</h2>

<p>Create and enter your project directory:</p>

<pre>
mkdir &lt;project_name&gt;
cd &lt;project_name&gt;
</pre>


<p>Check your versions:</p>

<pre>
yo --version && bower --version && grunt --version
1.1.2
1.3.5
grunt-cli v0.1.13
grunt v0.4.5
</pre>


<p>If you don&#8217;t see the last line listed, install grunt locally to the project</p>

<pre>
npm install grunt
</pre>


<p>If that throws some errors, you may have to make sure you actually <a href="http://stackoverflow.com/a/16151707/223362">own your .npm and tmp directories</a>:</p>

<pre>
sudo chown -R `whoami`.`whoami` ~/.npm
sudo chown -R `whoami`.`whoami` ~/tmp
</pre>


<p>Rerun the version check and you should see all 4 items listed.</p>

<h2>Scaffold</h2>

<p>Now go ahead and run yeoman:</p>

<pre>
yo
</pre>


<p>Pick whatever options you want.  For my first run at a project, I usually just go with the AngularJS settings and its defaults.  The one thing I&#8217;ve noticed with Yeoman and a globally installed npm is that it will fail during the actual module fetch process of the installation.  I&#8217;m guessing this is because npm was installed as root and the module directories are not user accessible.  Yeoman also doesn&#8217;t really like running as root, and I don&#8217;t like giving user level write permissions to system directories, so I just let it fail.  It doesn&#8217;t seem to be a problem as the proper configuration files are written out.</p>

<p>So once Yeoman fails, I do a manual npm installation of the modules:</p>

<pre>
sudo npm update -g
</pre>


<p>The -g in this case just tells the system to install them globally so that every project has access to it.  If it makes you feel uncomfortable to work in a directory that Yeoman failed to automatically complete (I tend to be like that), you can now nuke your project directory, and redo the above steps since now npm already has the required modules, Yeoman should be happy dandy and work properly to the end.</p>

<p>Oh, if you run Chromium, you will also want to make sure that the <a href="http://stackoverflow.com/a/18949408/223362">CHROME_BIN env variable is pointing to the chromium binary</a> so that &#8220;things will just work (tm)&#8221;.</p>

<pre>
echo 'export CHROME_BIN="/usr/bin/chromium-browser"' >> ~/.bashrc && source ~/.bashrc
</pre>


<p>At this point, you probably want to also setup git.  Just add what&#8217;s there and commit it.</p>

<pre>
git init                        # setups the project to use git
git add .                       # add initial content
git status                      # check status
git commit -m "Initial commit"  # first commit
git status                      # should be all clear
</pre>


<h2>Customize</h2>

<p>Bower is a great little tool for downloading whatever web module you&#8217;ll need for your project.  Use it to get the modules you want to play with <a href="http://bower.io/search/">from the repository</a>.</p>

<p>Here&#8217;s a list of commands for Bower that I use most often:</p>

<pre>
bower list                          # shows what bower has installed
bower cache clean                   # cleans bowers cache for a fresh full download
bower update                        # update your modules based on bower.json settings
bower install &lt;module&gt;        # installs module
bower install &lt;module&gt; --save # installs and adds to bower.json
bower uninstall &lt;module&gt;      # uninstalls module
bower info &lt;module&gt;           # shows information
bower prune                         # clean up unused stuff
</pre>


<p>Here are some of the Bower modules I use for my projects, which at the moment is Angular heavy.  Of course, necessity of these will be up to you:</p>

<pre>
bower install angular-ui-router --save                  # replacement for the standard angular router
bower install angulartics --save                        # analytics plugin for angular
bower install chieffancypants/angular-hotkeys --save    # hotkey for keyboard browsing and auto help screen
bower install angular-bootstrap --save                  # angularized bootstrap elements
bower install angular-touch --save                      # for touch based devices
</pre>


<p>The <code>--save</code> just makes sure that the installation information is saved to <code>bower.json</code>.  If you&#8217;re still experimenting and deciding if you really want to keep the module, just leave off the <code>--save</code>.  It makes it easier to just delete it once you decide against keeping it.  When ready, you can just rerun the install with the <code>--save</code> flag.</p>

<p>The nice thing about Yeoman is that it now installs the <code><a href="https://github.com/stephenplusplus/grunt-wiredep">grunt-wiredep</a></code> module for you.  Which means that in order to install the scripts and css of the modules downloaded by bower, all you need to do is to run <code>grunt</code> and during that process, grunt will autoinsert the right scripts and css into the right places in your html files.  Very convenient.</p>

<p>NPM similarly offer some useful modules.  These are the ones I load up:</p>

<pre>
npm install grunt-build-control --save  # For build and deployment
npm install grunt-targethtml --save     # For dynamic construction of HTML based on parameters
</pre>


<h2>Configure</h2>

<p>.gitignore: There are some changes you need to manually make to some of the configuration files to get the most out of them.  One is to make sure you have a decent .gitignore file so that you&#8217;re not checking in things you don&#8217;t need to.  The defaults should suffice, but who knows what files get stored in your project, so be sure to keep it up to date.</p>

<p>bower.json: You&#8217;ll also want to modify the bower.json file.  I usually remove the need for strict versions and instead allow the system to update to at least the major and minor versions, letting the patch version get updated freely.  There&#8217;s also a version number for your app at the top which you&#8217;ll want to keep up to date.  Update your modules by running <code>bower update</code>.</p>

<pre>
...
    "angular": "^1.3",
...
</pre>


<p>package.json: There&#8217;s also another place for version numbers in package.json for the server side npm modules.  You can also do the same with version numbers here as with bower if you&#8217;re confident enough.  There&#8217;s also a space for your app&#8217;s version number here too.  Not quite sure why we need it in both bower.json and package.json.</p>

<p>Gruntfile.js: This is probably the place you&#8217;ll end up mucking around the most.  You&#8217;re also going to have to manually add in the new npm modules that were installed into the package.json into the Gruntfile.js file.  Also be aware that with something like targethtml, which is used to render pages differently for development and production, the order where it gets executed does matter, so just be aware of that.</p>

<pre>
...
// For filerev, I've had to comment out the fonts revisioning since it didnt work well with my font loading done in the css file.
    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
          // '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },
...
// This is to make the changes to the index.html file in place once it's reached the dist directory.
    targethtml: {
      dist: {
        files: {
          '<%= yeoman.dist %>/index.html': '<%= yeoman.dist %>/index.html'
        }
      }
    },
...
// I added the last 3 items to the copy routine since it was missing.  I sometimes use a data dir for static data content.
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            ...
            'sitemap.xml',
            'styles/fonts/*',
            'data/*'
          ]
...
// This is for deployment via a remote git repository.  You'll have to fill in your own repository and credential information.
    // For deployment: http://curtisblackwell.com/blog/my-deploy-method-brings-most-of-the-boys-to-the-yard
    buildcontrol: {
      options: {
        dir: '<%= yeoman.dist %>',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      production: {
        options: {
          remote: '&lt;user&gt;@&lt;domain&gt;.com:/path/to/repository/production.git',
          branch: 'master',
          tag: appConfig.app.version
        }
      }
    }
...
// htmlmin does not play nice with angular, so it gets commented out.
// Also note where 'targethtml' is placed, right after 'copy:dist'
  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'targethtml',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin'
//    'htmlmin'
  ]);
...
// Registering the deploy command
  grunt.registerTask('deploy', [
    'buildcontrol:production'
  ]);
</pre>


<h2>Deployment</h2>

<p>Ah, this is still causing me some trouble, but I can get it to work well enough, so may as well.</p>

<p>If you already know where you will be deploying to, you can setup your production/staging git repository and link it to your development environment.  Check out <a href="http://curtisblackwell.com/blog/my-deploy-method-brings-most-of-the-boys-to-the-yard">Curtis Blackwell&#8217;s setup instructions</a> to get the nitty gritty details on how to do this.  It&#8217;s almost complete, but with <strong>one change</strong>.  Do not link your local git repository to the remote one.  The <code>grunt-build-control</code> plugin will contain all the information needed about the remote repository so you don&#8217;t have to explicitly link it.  In fact, the way it works (I think) is that the build process uses the git repository information in the Gruntfile.js and pulls from it to your local dist/ dir.  Then it does the local build to update it with the newest content, commits, and pushes back to the upstream repository.</p>

<p>The process is atomic so you don&#8217;t have to worry about git state.  You can even empty the dist/ directory (and remove the .git directory in there) and it will simply get rebuilt and reprocessed during the next build.</p>

<p>But read Curtis&#8217; instructions anyway for the setup needed server side: <a href="http://curtisblackwell.com/blog/my-deploy-method-brings-most-of-the-boys-to-the-yard">My Deploy Method Brings Most of the Boys to the Yard</a></p>

<p>If you do link your local git repo to the remote deployment repository, you&#8217;re linking your uncompiled project repository to a compiled distribution repository which will not be compatible with each other.  Lots of fun errors will eventually ensue especially if you accidentally push or pull.  Not that I would do such a mistake&#8230;</p>

<p>Caveat: For some reason, when deploying, the system will create a remote repository branch and add that as a remote to my main git development repository.  The result will be that git will start to complain that the commits are not in sync and you need to pull the content from the remote to stay in sync.  Don&#8217;t do it.  Instead, you can just remove the remote repository <code>git remote remove remote-fc9047</code>.  Get that repo name by doing a <code>git remote</code> and finding the remote-xx0000 named remote branch.  Then be sure to delete the .git directory from the dist/ dir.</p>

<p>I have no idea why this happens, and how to prevent it, but at least the fix is reasonableish.</p>

<p>Now would also be a good time to link you repo to your actual source code repository.  Something like:</p>

<pre>
git remote add origin <user>@<domain.com>:/path/to/repository.git   # Link your repositories
git push --set-upstream origin master                               # So that you can just "git push"
</pre>


<p>Now you&#8217;re set to push your source code to one repository, and your compiled deployment files will automatically get pushed to your production repository.</p>

<h2>Run</h2>

<p>Pretty simple to run your project.  Everything is controlled by Grunt:</p>

<pre>
grunt               # runs through all the tests and checks everything
grunt clean         # cleans and reset things
grunt build         # does all the minification and optimizations in preparation for a distributable
grunt deploy        # deploys your project to your remote location (needs the grunt-build-control module and setup in Gruntfile.js)
grunt serve         # runs the project
grunt serve:dist    # runs the project with production code, a must to do some last minute checks to make sure Grunt compiled everything right
</pre>


<p>Since Yeoman preconfigures live reload support, I usually have a dedicated terminal open that&#8217;s running <code>grunt serve</code>.</p>

<h2>Fixes</h2>

<h4>OptiPNG</h4>

<p>I&#8217;ve run into an issue with <code>opipng</code> during imagemin&#8217;s Grunt task:</p>

<pre>
Warning: Running "imagemin:dist" (imagemin) task
Warning: Command failed: ** Error: Lossy operations are not currently supported
Use --force to continue.
</pre>


<p>I have no in depth clue as to what is really the issue, only that this seems to happen <a href="https://github.com/gruntjs/grunt-contrib-imagemin/issues/180">with OptiPNG 0.6.4</a>, which for some reason is the current version on my Ubuntu (13.04).  No idea why it isn&#8217;t automatically updating to the 0.7 track, but you can remove it to get around the block (or update it I guess):</p>

<pre>
sudo apt-get remove optipng
</pre>


<h4>Empty vendor.js</h4>

<p>As of this writing, there&#8217;s a severe bug in how Yeoman generates the Gruntfile.js and the index.html.  Basically the left hand doesn&#8217;t know what the right hand is doing and you end up with &#8220;angular not found&#8221; type errors when doing a &#8220;grunt serve:dist&#8221;.  Basically, the generation script is fubar.  What happens is that the <code>bower_components</code> directory is now placed in the project root instead of the <code>app/</code> dir and while that works fine for local testing, when Grunt builds the system, it scans the html and sees that the html is referencing <code>app/bower_components</code> and appends it as the path to the bower files.  This causes the usemin script in Grunt to try to look for the files in the wrong place.  The end result is empty vendor.js and vendor.css files in the <code>dist/</code> dir.</p>

<p>Anyway, more about it <a href="https://plus.google.com/107762004876412812922/posts/br3V3uVXN4A">here</a> and the fix is <a href="https://github.com/yeoman/generator-angular/pull/719/files">here</a>.  Basically you need to adjust the build statements in your index.html:</p>

<pre>
    &lt;!-- build:css ... --&gt;
becomes
    &lt;!-- build:css(.) ... --&gt;
</pre>


<p>I&#8217;m assuming an egregious mistake like this will be fixed soon so all this may be a moot point sooner or later.</p>

<h2>Workflow</h2>

<p>So once everything is setup and working, my workflow usually consists of this:</p>

<pre>
* Make code changes
* git add .
* git commit -m "<message>"
* git tag vx.y.z                # If the code requires a version bump, tag it and also change bower.json and package.json
* git status                    # Just to make sure we're clean and ready
* grunt build                   # Builds and tests everything
* grunt serve:dist              # Runs the production code.  A good last minute check to make sure Grunt generated everything correctly.
* grunt deploy                  # If the code is production ready, deploy it.
</pre>


<p>Well, and the occasional:</p>

<pre>
* rm -rf dist/.git
* git remove remote remote-xx0000
</pre>


<p>Which I can live with till I figure out what&#8217;s going on.</p>

<h2>Feedback</h2>

<p>So that&#8217;s about it for now.  It&#8217;s a touch complicated to read over, but hopefully it can help you out in getting started with using Yeoman to bootstrap your project to your liking.  Let me know of any feedback, questions, suggestions and so on.</p>

<p>Thanks!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[robibrunner.com]]></title>
    <link href="http://subdigit.com/blog/robibrunner-dot-com/"/>
    <updated>2014-05-16T12:00:00-07:00</updated>
    <id>http://subdigit.com/blog/robibrunner-dot-com</id>
    <content type="html"><![CDATA[<h3>Eponymous Site</h3>

<p><a class="gallery" rel="eponymous" href="https://lh5.googleusercontent.com/-x-8ulYtFfQs/U3ZQcM7F9xI/AAAAAAAAIJo/c_EJrbGOr2Y/w1247-h828-no/DSC_4729.JPG" title="Everything starts with pen and paper"><img class="left" src="https://lh5.googleusercontent.com/-x-8ulYtFfQs/U3ZQcM7F9xI/AAAAAAAAIJo/c_EJrbGOr2Y/w300/DSC_4729.JPG" width="300" alt=""/></a></p>

<p>It always starts with pen and paper doesn&#8217;t it.</p>

<p>I first registered the eponymous domain back in Febrary&#8230; <em>of <strong>1999</strong></em>.  After lazying around for a good 15 years with a default Wordpress landing page, I thought it was high time to actually do something with the extremely dormant domain.  Extremely.</p>

<p>So here we are.  15 years later.  From crappy to&#8230; at least not as crappy.</p>

<p>Check it out: <a href="http://goo.gl/Bd30lL">robibrunner.com</a></p>

<h4>Why?</h4>

<p>Why suddenly after 15 years do I decide to finally do something more than a click-button-install of Wordpress?  I just thought it was time to anchor my name to something other than a dreadfully default site.  I also wanted to create a site that I controlled that can house data about me that is for me, by me, and with my interests in mind.  I&#8217;m not saying I was slighted by any social network, on the contrary, I&#8217;m perfectly happy contributing my information to them.  It&#8217;s just that there are numerous places I do things, and no single place where I can aggregate it all in a manner that I want.  Especially in a selectively curated manner.</p>

<p>Hence, I thought it might be a good plan to -revive- create the site and use it as an aggregation point for me.  Yeah, it&#8217;s one of those self serving &#8220;me&#8221; projects.</p>

<p>But it&#8217;s all for a good cause.  Well, a good cause for me anyway.  I wanted to take this opportunity to check out some new technologies out there and play with them to see what they can do, and probably more importantly, what I can do with them.</p>

<h4>The Plan</h4>

<p><a class="gallery" rel="eponymous" href="https://lh3.googleusercontent.com/-iGVTXCxIgzw/U3ZQcVlil-I/AAAAAAAAIJs/HwZJ7RbWelk/w1247-h828-no/DSC_4732.JPG" title="More visual tests"><img class="right" src="https://lh3.googleusercontent.com/-iGVTXCxIgzw/U3ZQcVlil-I/AAAAAAAAIJs/HwZJ7RbWelk/w300/DSC_4732.JPG" width="300" alt=""/></a></p>

<p>Since the site is meant to be on the simple side, I wanted to keep it minimal and see what I could do.  No fancy logins or backend systems.  No need for cluttered widgets or ads.  The plan was to write a Single Page App running completely just with client code, perhaps with a json file containing the data I wanted to display.  That&#8217;s it.  Nothing complicated.</p>

<p>This gave me an excuse to try out things like <a href="http://yeoman.io">Yeoman</a>, <a href="http://angularjs.org">AngularJS</a>, and all the assorted goodies that come with those stacks.  And it turned out to be pretty interesting to see what was out there.</p>

<h4>The Design</h4>

<p><a class="gallery" rel="eponymous" href="https://lh4.googleusercontent.com/-Kex-QAW-PPY/U3ZQaXBx25I/AAAAAAAAIJk/cWrIlpnYQU4/w1248-h698-no/eponymous+-+v0.png" title="Very early on."><img class="right" src="https://lh4.googleusercontent.com/-Kex-QAW-PPY/U3ZQaXBx25I/AAAAAAAAIJk/cWrIlpnYQU4/w300/eponymous+-+v0.png" width="300" alt=""/></a></p>

<p>I&#8217;m not much of a designer, but I do what I can.  I wanted something that would becon a little user interaction.  There&#8217;s probably a choice to be made here between providing a page that has everything already laid out and visible so that all the user has to do is scroll, and a site that tries to entice the user to interact with the various elements and see what goes where.  Common instinct tells me I shouldn&#8217;t make the user do any extra work to see my content, but at the same time, my own gut tells me that I want to build something compelling enough that makes the user want to interact with the site.  If I can&#8217;t get them to at least be that engaged, I don&#8217;t see a point in just spewing out content.</p>

<p>If I can&#8217;t engage the user enough that they want to read my copy, then I&#8217;ve failed anyway, and no amount of no-interaction-needed style of page display will help them grasp my content.</p>

<p>So that was my mindset.  You&#8217;re going to have to do some work to see what I do, and I hope it&#8217;s interesting enough that you will.</p>

<h4>The Execution</h4>

<p><a class="gallery" rel="eponymous" href="https://lh3.googleusercontent.com/-FtAkEw8tkAk/U3ZQb-TOGQI/AAAAAAAAIJg/ZXJD195iKbE/w1248-h698-no/eponymous+-+v1.png" title="Cleaned up and ready to be seen."><img class="left" src="https://lh3.googleusercontent.com/-FtAkEw8tkAk/U3ZQb-TOGQI/AAAAAAAAIJg/ZXJD195iKbE/w300/eponymous+-+v1.png" width="300" alt=""/></a></p>

<p>As mentioned, Yeoman was high on my list to try out since it frameworked everything I would need for this site.  It created an Angular project, droped in Grunt so that I can build it, configured it with some sensible defaults to do things like pack js and css files into one and minify images.  It also installed Bower to grab all the nifty libraries I may need and pack them into the index.html.  It&#8217;s a pretty nice setup where once setup, I can take my time to browse around the various files it configured and see exactly what it did.  Nothing better than to learn from a few live examples.</p>

<p>Oh yeah, there&#8217;s also testing included too.  That one I still need to leverage fully.  When things are rapidly changing, especially in the beginning stages of an application, I feel like it sometimes takes way too much effort to write full scale tests.  That&#8217;s just something I need to get into my workflow a little more to make it work right.</p>

<p>The site also needed to be responsive to work on mobile devices, so I had to dive into a little bit of CSS hacking to make things look right.  Adjust element sizes, column counts, and so on to accomodate for smaller displays.  For better or worse, everything needs to be designed with mobile in mind, if not mobile first, even for this kind of site.  It&#8217;s certainly a paradigm shift.</p>

<p>I wont go over too much in detail what I did, simply because I used the <a href="http://goo.gl/Su7zN3">Info</a> section to document the details of what I used to make the site what it is.  Web page design is never a trivial matter, even if it&#8217;s a mere one page app.  Hopefully the attributions to various modules, stackoverflow answers, and technologies used can be insightful to someone else that may be interested in seeing how I did what I did (not that it&#8217;s anything overtly complex), and more importantly, use it to do what they want with it.</p>

<p>The underlying code is still slightly embarassingly messy, as it was a learning process.  The Angular directives, services, factories and controllers I wrote are nothing particularly share worthy, but more importantly, it gave me a good feel for how they <em>should</em> be done and what I can do with them.  I&#8217;m really liking the way Angular works and I think it&#8217;s a huge paradigm changing way for writing Javascript and doing web development.  As they say, things wont be the same after this.</p>

<h4>What&#8217;s Next</h4>

<p>A learning experience can only validate itself if it gets applied to something else.  So naturally, onto the next project.  The next project will be incorporating a back end, probably MongoDB, or maybe even Firebase.  But I&#8217;m still not sold on outsourcing everything to the cloud when I can have a perfectly reliable server in my own control.  Perhaps that&#8217;s one thing I need to still get used to.</p>

<p>It may also require some sort of user backend, which implies a login system, which implies an <a href="http://goo.gl/f5vbe">authentication plan</a>.  I&#8217;ll have to first decide if I want to write it as a Java back end, or to go with something like Node.js and Hapi/Express on the server side.  Either way, it looks like I&#8217;m going to have to upgrade my domain hosting plan to allow for me to do something a little more complex.  Well, maybe if I go Firebase, I can avoid that.  A little more thinking needed on my part, but we&#8217;ll see how it goes :).</p>

<h4>Feedback</h4>

<p>Feel free to visit the site: <a href="http://goo.gl/Bd30lL">robibrunner.com</a> and let me know what you think.  Tear it apart or question why I did something in a particular way.  I&#8217;m always up for a little discussion.  I&#8217;m sure there&#8217;s a lot to add or perhaps some things that just are plain wrong that I&#8217;m blind to, but either way, it was interesting to kick the tires of modern web development.  Things sure move fast :).</p>

<p><span style="font-size: 0.50em; color: #aaa;">yeah, I know.  15 years.  Cause 16 would have been just too ridiculously long :).</span></p>

<p><meta name="description" content="Reviving my eponymous domain after 15 years of the 'First Post' Wordpress default." /></p>

<p><meta property="og:type" content="article" />
<meta property="og:site_name" content="subdigit" />
<meta property="og:title" content="robibrunner.com - musings between the lines" />
<meta property="og:description" content="Reviving my eponymous domain after 15 years of the 'First Post' Wordpress default." />
<meta property="og:image" content="https://lh3.googleusercontent.com/-FtAkEw8tkAk/U3ZQb-TOGQI/AAAAAAAAIJg/ZXJD195iKbE/w1248-h698-no/eponymous+-+v1.png" />
<meta property="og:image" content="https://lh5.googleusercontent.com/Qk5C0R-UXsbELDB--G95Cc2EtjoKiI-zlE50-VX4mh8=w1247-h828-no" />
<meta property="og:image" content="https://lh3.googleusercontent.com/-iGVTXCxIgzw/U3ZQcVlil-I/AAAAAAAAIJs/HwZJ7RbWelk/w1247-h828-no/DSC_4732.JPG" />
<meta property="og:image" content="https://lh4.googleusercontent.com/-Kex-QAW-PPY/U3ZQaXBx25I/AAAAAAAAIJk/cWrIlpnYQU4/w1248-h698-no/eponymous+-+v0.png" />
<meta property="og:url" content="http://subdigit.com/blog/robibrunner-dot-com/" /></p>

<p><meta name="twitter:card" content="summary" />
<meta name="twitter:url" content="http://subdigit.com/blog/robibrunner-dot-com/" />
<meta name="twitter:title" content="robibrunner.com - musings between the lines" />
<meta name="twitter:description" content="Reviving my eponymous domain after 15 years of the 'First Post' Wordpress default." />
<meta name="twitter:image" content="https://lh3.googleusercontent.com/-FtAkEw8tkAk/U3ZQb-TOGQI/AAAAAAAAIJg/ZXJD195iKbE/w1248-h698-no/eponymous+-+v1.png" />
<meta name="twitter:site" content="subdigit.com" />
<meta name="twitter:creator" content="subdigit" /></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[development diary - Jan 2014]]></title>
    <link href="http://subdigit.com/blog/development-diary-jan-2014/"/>
    <updated>2014-01-31T08:30:00-08:00</updated>
    <id>http://subdigit.com/blog/development-diary-jan-2014</id>
    <content type="html"><![CDATA[<h3>January 2014</h3>

<p><img class="left" src="https://lh4.googleusercontent.com/-gh4sMeCBSug/UurBUfxQWQI/AAAAAAAAHwQ/1O9MUM8PHTA/s200/phpCode.jpg" width="200" height="200" title="development" ></p>

<p>I have no idea how short or long these things will be, but I thought it&#8217;ll be a nice attempt to keep myself honest and maintain a development diary so that I&#8217;ll be forced to account for my time and actions over the course of the year, one month at a time.</p>

<p>Some items may be a bit cryptic since there will be some projects I&#8217;m working on that I&#8217;m not quite ready to talk about in specifics, but at least it&#8217;ll get some sort of mention.  Either way, a progress report is due, so let&#8217;s start with January of 2014.</p>

<ul>
<li><p><a href="https://github.com/subdigit/core">core</a> : I&#8217;ll cheat a little and bleed into December, but basically I&#8217;ve wrapped up some of the major features of the system that I wanted to have in place.  It&#8217;s working, but as usual, not quite as well as I like.  The basics are there, but it&#8217;s far from intuitively usable, hence no real announcement.  I still need to properly build out a new user module separate from the core module that will stack on top to give the foundation for genuinely starting a bootstrap site.</p></li>
<li><p><a href="https://github.com/subdigit/authentication">authentication</a> : Not too much here.  Just a little cleanup to fix some code that broke the Persona system from working right.  Actually, it was the sample that wasn&#8217;t working.  The backend code catching the Persona requests were just fine.</p></li>
<li><p>project &#8220;ab&#8221; : We sat down for an initial chat about what we wanted to get out of the project.  Got some servers and logins out of the way and wrote up a quick milestone chart to see when we&#8217;ll get to some interesting publicizable code.  Let&#8217;s see how it goes.  Lots to do here.</p></li>
<li><p>misc : Getting my thoughts in order for what type of projects I want to tackle.  I have quite a few in mind, but making myself narrow it down to a handful that I can work on.  Some will be just casual tinkering on the side and others will require a little bit more effort.  Will have to be careful not to have them bleed out too much time from each other.</p></li>
</ul>


<p><span style="font-size: 0.50em; color: #aaa;">I have no idea how long this will last.  Image sourced from <a href="http://redbonzai.com/update-multiple-rows-in-a-single-query/">Red Bonzai</a></span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[user profiling]]></title>
    <link href="http://subdigit.com/blog/user-profiling/"/>
    <updated>2014-01-15T08:00:00-08:00</updated>
    <id>http://subdigit.com/blog/user-profiling</id>
    <content type="html"><![CDATA[<h3>User Profiling</h3>

<p><img class="left" src="https://lh3.googleusercontent.com/-vxtOFsB6c08/UtWelvFRt3I/AAAAAAAAHpU/VgWmi3EqqaQ/s200-no/anonymous_200.gif" width="200" height="200" title="user" ></p>

<p>Nearly every system that has any type of persistent user identification needs a profiling system.  I&#8217;m in the process of <a href="https://github.com/subdigit/core">writing a framework</a> (more on that at another time) that will let me kickstart future Java projects with a sound base like data storage and retrieval, json based REST APIs, and agnostic web framework containment.  So naturally, a starter base for a user system would be something nice to have.</p>

<p>The question then becomes how to write it in a generic manner that wont be too specific to a particular instance of an application but also not too generic that it starts to become too nebulous and not tight enough for use.  So choice have to be made.</p>

<p>Part of that will be that the user subsystem will probably be an abstract implementation.  It&#8217;ll contain the basics that every profiling system should have, and then leave the details of the rest to a higher level implementation.  This should achieve the goal of saving time getting the structure in place and the rest becomes filling in the implementation details.  The reason for even wanting a user subsystem in first place is to start to enable some basics editing authorizations for the other systems in the core framework.  I&#8217;m hoping that having, at least in abstract form, a more concrete user system will allow me to start to issue these authorizations at a lower framework level that can then float up higher as more pieces are implemented.  Less work later on if a foundation is laid for the basics.  Or something like that.</p>

<h4>Pieces</h4>

<p>I just wanted to start to review the general pieces of a usable user subsystem and what it should have in order to act as a reasonable base for most projects.  I&#8217;m willing to have it be a little opinionated in order to satisfy most projects that might need this type of thing, but also willingly exclude some the edge case projects.  I figured with those, I can actually fork and refactor the code as needed instead of extending and implementing it.</p>

<p>I&#8217;ve designed and built profiling systems in the past, but they were rebuilt each time for each project as needed.  Also, being internal to a company, there were vastly different data association requirements (no need for name/email verification, tertiary data store for person information, etc).</p>

<p>At the moment, this subsystem is just getting off the ground, so I haven&#8217;t decided yet how granular it will be.  Do I store some very generic preferences with the main object?  Do I split those out to a separate named object?  A generic preference association system?  How detailed should it become - track login times?  Track it with location information?  Keep a history of all login timestamps and duration?</p>

<p>It&#8217;s going to be useless to accommodate all possible combinations between projects that want that type of granular information and others that don&#8217;t, hence I&#8217;ll probably just decide on what most of my projects may need and start from there.  In the end, if I build into it a concept of a generic preference storage system, it may suffice for most cases.  We&#8217;ll see.</p>

<h4>Design</h4>

<p>So, here are some of the data points about a user that would be convenient to have in a profiling system:</p>

<ul>
<li>Unique System ID - Internal identifier</li>
<li>Unique Username - External identifier</li>
<li>Display Name - Common societal name</li>
<li>Email - More for contact/news delivery purposes</li>
<li>Email Verified - Just to make sure the user is who they say they are</li>
<li>Is Admin - Simple administrator flag for special access</li>
<li>Date Created - Date account was created</li>
<li>Date Updated - Date account was updated by the user</li>
<li>Date Touched - Date account was accessed by the user</li>
<li>Date Deleted - Date of deletion request (if deletion is delayed or if the account is simply removed from visibility)</li>
<li>Date Logged In - Date of last login.</li>
<li>Associated Accounts - 3rd party accounts used for login.  From the <a href="http://goo.gl/bNZFw">Authentication Module</a></li>
<li>Preferences - Simple key/value preference pair storage system</li>
</ul>


<h4>Kill it with fire</h4>

<p>One normally salient piece of information missing is &#8220;Password&#8221;.  I&#8217;m not going to use one, nor an option for a traditional login.  Everything is going to be dependent on some form of 3rd party login that the user should have access to.   I do not want to be in the business of storing and securing password information, especially since it raises a lot of security concerns, and it feels like a disservice to store it, even if salted, because it forces to the user to have to create and maintain yet another password, which will undoubtedly be a copy of another password from another site.</p>

<p>By eliminating it, it protects this system from compromises elsewhere, and protects other systems from compromises to this one.  So instead, I&#8217;ll rely on login via sites like Twitter, Google+, Facebook and even Mozilla&#8217;s Persona system in lieu of having a direct login.  They can offer the ability to remove access to the project should a compromise occur.  It&#8217;s a tradeoff with a reliance on a 3rd party system and better (perhaps falsely optimistic) security.  It&#8217;s the day and age of the interwebs, we&#8217;re all going to be connected and networking is almost ubiquitous, so it&#8217;s a good time to start taking advantage of it.</p>

<p>Will this cause some issues further down the road should these systems be offline or meet their hype demise?  Possibly, but I think some of that can be mitigated by enabling the user to tie in several systems together to offer a variety of ways to get into their account should their preferred one go the way of the dodo.</p>

<p>At any rate, this will be one of the opinionated ways in which I&#8217;ll be designing this system to see if it&#8217;ll be something that can be sustainable.</p>

<h4>Feedback</h4>

<p>Let me know of any additional thoughts on what should be here.  I&#8217;m sure there&#8217;s a lot to add or perhaps some things that just are plain wrong that I&#8217;m blind to.</p>

<p><span style="font-size: 0.50em; color: #aaa;">It&#8217;s been eons since I&#8217;ve written a profiling system&#8230;  Image sourced from <a href="http://www.infragistics.com/events/chattanooga-user-group/">somewhere completely random</a></span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[maven workflow]]></title>
    <link href="http://subdigit.com/blog/maven-workflow/"/>
    <updated>2014-01-06T09:00:00-08:00</updated>
    <id>http://subdigit.com/blog/maven-workflow</id>
    <content type="html"><![CDATA[<h3>Maven Workflow</h3>

<p><img class="left" src="https://lh5.googleusercontent.com/-94qdzC1_Omw/UW3O01_oMMI/AAAAAAAAFi4/dChpvlEp8M8/s200/maven.png" width="200" height="200" title="maven" ></p>

<p>I stumbled upon Maven much <em>much</em> later in my Java career than I should have.  But now that I&#8217;m here, I&#8217;d like to leverage it for my needs.  It&#8217;s a pretty versatile system that can do quite a lot.  I&#8217;m sure much more than I&#8217;d care to explore.  I&#8217;m not going to really introduce it as there&#8217;s enough on the web you can browse to basically get the hang of what Maven is about and what it can do for you.</p>

<p>For the purposes of this post, I&#8217;m going to catalog some of the things I did to configure Maven so that it can accomplish my workflow goals.  Namely:</p>

<ol>
<li>Create a Java project that can be managed by Maven and developed in Eclipse.</li>
<li>Commit to a source control management system.</li>
<li>Install to the local Maven repository so other projects can use it.</li>
<li>Run the project in a web container.</li>
<li>Sync the content to an external repository.</li>
<li>Deploy releases of the project as a zip and to a maven repository.</li>
</ol>


<p>If you need an introduction to what Maven is or the exact inner workings of a pom.xml, this post wont be that.  But if you want to take a peek at some of the things I&#8217;ve clobbered together in the pom.xml, and perhaps have any other neat suggestions, feel free to take a look and contribute some of your own solutions.</p>

<h4>Commands</h4>

<p>But first, a little bit of a cheatsheet for the commands I most commonly use in Maven:</p>

<ul>
<li><code>mvn clean</code> : Return the project to base state.  Basically removes the &#8220;target&#8221; directory.</li>
<li><code>mvn package</code> : Create the jars and packaged items (like wars) from your code</li>
<li><code>mvn install</code> : Install the project to your local repository.  Keeps any -SNAPSHOT monikers used.</li>
<li><code>mvn deploy</code> : Pushed the installed project to remote maven repositories.</li>
<li><code>mvn release:prepare</code> : Prepares the project for release.  Be sure to check in all your code first else this will faile.  Also the release process will automatically remove any -SNAPSHOT monikers from your version and allow you to specify the next version to update to.  Pretty convenient.</li>
<li><code>mvn release:perform</code> : Once prepared, actually performs the release.  This means doing any install and deploy calls.</li>
<li><code>mvn release:clean</code> : Cleans up the release details like the property file and so on.  Especially useful if you forgot to checkin prior to doing the prepare stage.  Although the plugin is smart enough to continue where you left off, I usually just like to have a clean start all the way through.</li>
<li><code>mvn release:rollback</code> : Rollsback a release to the previous version.  I haven&#8217;t quite used this enough to really make use of it yet.</li>
<li><code>mvn war:war</code> : Explicitly creates the packaged war file for a project.  Even if the project is specifying a packaging of jar.</li>
<li><code>mvn tomcat7:run</code> : Runs the project in a tomcat environment.  No need to explicitly create a war via the pom.xml or to execute war:war.  It&#8217;ll just do it.</li>
</ul>


<h4>pom.xml</h4>

<p>And the related pom.xml I&#8217;ve crafted to get the steps above done.  It took a while to cobble it together and it&#8217;s still not quite fully there, but close enough.  I&#8217;ll use the <a href="http://goo.gl/bNZFw">authentication module</a>&#8217;s pom.xml as an example.  See the version this post is based on: <a href="http://goo.gl/wdxM4p">pom.xml</a> and perhaps to what it has currently evolved: <a href="http://goo.gl/dH24gR">pom.xml</a>.</p>

<h4>1. Create</h4>

<p>I&#8217;ve listed the creation step as a formality since I need to remind myself how it gets done.  However, I already did that with the <a href="http://goo.gl/46BKN">maven setup</a> post, so go there, get setup, and come back.</p>

<h4>2. Commit</h4>

<p>Once your project is there, all you basically need to do is to <code>git init</code> in the directory and you&#8217;re all set.  Most of the useful commands I use git, including some setup tips, I&#8217;ve cataloged on the <a href="http://goo.gl/f2NXR">git cheatsheet</a> post.</p>

<h4>3. Install</h4>

<p>I usually write components and frameworks where one project will rely on another.  So it&#8217;s important to have a way to nicely package and install these projects to a central location from where it can be synced.  Maven offers a local repository to do just that.  All you need to do once you&#8217;re ready is to do a:</p>

<p><code>mvn install</code></p>

<p>and the code should get packaged and installed to your local maven repository.  Then other projects can simply add their dependency for your project based on your group and artifact ids (and version).  Now why bother doing this if Eclipse can simply link the 2 projects together?  It&#8217;s just more universal.  You wont be tied down to Eclipse to manage the interconnection and if you want to reuse your component in something like a <a href="http://www.playframework.com/">Play Framework</a> project, it&#8217;s a trivial addition to add your local project just like you would any other public project.  It&#8217;s one of those that&#8217;s simple to do and just better in the long run to get used to.</p>

<h4>4. Run</h4>

<p>Often times, even if I&#8217;m creating a component piece, I may want to include a simple showcase just to help the end user/developer visualize what the project is about.  Normally, by Maven convention, you would have a base <code>&lt;packaging&gt;jar&lt;/packaging&gt;</code> project and a related <code>&lt;packaging&gt;war&lt;/packaging&gt;</code> project inked to it for the simple application.  But I find it to be rather cumbersome to have 2 projects just for a simple showcase.</p>

<p>So instead, you can actually get away with telling maven to create your project as a web app, change the packaging to &#8220;jar&#8221; in the pom.xml, attach the tomcat plugin to it, and just tell it to ignore the packaging and run:</p>

<pre>
&lt;plugin&gt;
  &lt;groupId>org.apache.tomcat.maven&lt;/groupId&gt;
  &lt;artifactId>tomcat7-maven-plugin&lt;/artifactId&gt;
  &lt;version>${tomcat7-maven-plugin.version}&lt;/version&gt;
  &lt;configuration&gt;
     &lt;ignorePackaging>true&lt;/ignorePackaging&gt;
    &lt;url>http://localhost:8080/manager&lt;/url&gt;
  &lt;/configuration&gt;
&lt;/plugin&gt;
</pre>


<p>Magically it treats your jar project as a war (provided you created it as a web app) and just makes it run in the tomcat environment via this command:</p>

<p><code>mvn tomcat7:run</code></p>

<p>I had actually <a href="https://plus.google.com/107762004876412812922/posts/fAaewSE2nf4">experimented</a> with trying to keep the packaging as a war and telling maven to export just the jar into the local maven repository for shared use, but for some reason, it would always copy the .war over to the local maven repo as the .jar, which essentially broke all the downstream projects.  I&#8217;m not sure why this happens, and a <a href="http://jira.codehaus.org/browse/MWAR-121">similar issue</a> seems to simply have been closed.</p>

<p>So now I keep it packaged as a jar and if, for some reason, I <em>actually</em> want the war, I&#8217;ll use the <code>mvn war:war</code> command.  Otherwise, the <code>mvn tomcat7:run</code> command works just fine.</p>

<h4>5. Sync</h4>

<p>For public projects, I, like quite a lot of developers, decided that GitHub can get that honor.  For a simple sync of the code, it&#8217;s nothing more than your usual <code>git push</code> to push your code to GitHub.  But a release deploy is a little different.</p>

<h4>6. Deploy</h4>

<p>Not only do I want to sync my code to GitHub, I want to use GitHub as a release hub for my code.  This means that I would like to have my code packaged as a zip file, version tagged with the current version number I&#8217;m working on, upload it to the &#8220;Releases&#8221; section in GitHub, and increment my local version to the next iteration so that I can continue to work on the next version right away.</p>

<p>Not only that, I&#8217;d like to be able to offer my code to a Maven repository so that others can access it via Maven (or sbt) instead of downloading it.  While officially, you&#8217;ll probably want to <a href="http://datumedge.blogspot.com/2012/05/publishing-from-github-to-maven-central.html">formally release your code</a> to somewhere like Sonatype&#8217;s system so that your project will hit the main Maven repository, I just haven&#8217;t gotten that far yet.  In the meantime, you can apparently just create a branch in GitHub to host your code.  Sounds like a good compromise solution for the time being.</p>

<p>Luckily, GitHub offers <a href="http://search.maven.org/#browse%7C-1835235742">a plugin for all this</a>.  You will have to <a href="http://stackoverflow.com/a/14013645">modify a few things</a> to make it work:</p>

<ul>
<li>Add your GitHub credentials to settings.xml</li>
<li>Add a distributionManagement section to the pom.xml</li>
<li>Configure the maven-release-plugin to use the version format you want (or if you don&#8217;t care, no need).</li>
<li>Configure the site-maven-plugin with your desired details for release and maven repository publication.</li>
</ul>


<p>Once all that is complete:</p>

<p><code>mvn clean</code><br />
<code>mvn release:prepare</code><br />
<code>mvn release:perform</code></p>

<p>should get you rolling.  It&#8217;s going to ask you versioning information and so on about your release and incremental version.  It&#8217;s not too bad, but be sure to commit your work first, else the process will fail and you&#8217;ll probably want to <code>mvn release:clean</code> before trying again just to make sure you get a proper clean start.  When all is said and done, you should see your <a href="https://github.com/subdigit/authentication/releases">releases section populated</a> and the <a href="https://github.com/subdigit/authentication/tree/mvn-repo">named repository branch</a> should have your latest release ready for public use.  The repository for people to point to will be something like this:</p>

<pre>
&lt;repository&gt;
  &lt;id&gt;com.subdigit.authentication&lt;/id&gt;
  &lt;url&gt;https://raw.github.com/subdigit/authentication/mvn-repo/&lt;/url&gt;
  &lt;snapshots&gt;
    &lt;enabled&gt;true&lt;/enabled&gt;
    &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
  &lt;/snapshots&gt;
&lt;/repository&gt;
</pre>


<p>The one catch though is the plugin cant seem to do a nicely formated native release.  So be sure to click on the version number of the release and edit it manually.  Add whatever description you want and any other details, save, and it should look a whole lot better.</p>

<h4>Suggestions?</h4>

<p>I hope this helps.  It&#8217;s nothing special, just something I want to use to help automate my project maintenance/publication workflow.  I&#8217;m sure there are a lot of improvements that could be made and other neat tips and tricks to shove into the pom.xml, so if you have any, I&#8217;m more than happy to entertain suggestions.</p>

<p>Thanks!</p>

<p><span style="font-size: 0.50em; color: #aaa;">I hope this takes care of a lot of the administrative stuff I dont really care to think about too often.  Maven image sourced from <a href="http://www.ideyatech.com/2012/07/setting-up-maven/">ideyatech</a></span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[google+ and youtube]]></title>
    <link href="http://subdigit.com/blog/youtube-and-google-plus/"/>
    <updated>2013-11-08T09:00:00-08:00</updated>
    <id>http://subdigit.com/blog/youtube-and-google-plus</id>
    <content type="html"><![CDATA[<p><img class="left" src="https://lh6.googleusercontent.com/-HgAW-XclEJo/Un0PvCdqu1I/AAAAAAAAHoM/2J9GQI7O0e8/s828-no/iTunesArtwork%25402x.png" width="320" height="320" title="youtube" >
While in general, I do approve of the whole commenting system overhaul of Youtube, I thought I&#8217;d go check it out first hand.  I&#8217;ve <em>never</em> commented on any Youtube videos in the past and only read the comments out of sheer amusement at the internet trolls.</p>

<p>So from that perspective, getting rid of the trolls is certainly a plus (and a minus for amusement value, but I&#8217;ll deal with that).</p>

<p>The issues I have though are with execution.</p>

<p>I like that the videos I share from Youtube show up [a bit incorrectly] as a &#8220;comment&#8221; to the video on Youtube and all subsequent replies here also show up there.  (Can we <em>please</em> do that with public Communities?)</p>

<p>But for some reason, I have to unblock 3rd party cookies in order to get commenting to work.  Took a while to figure that one out as blocking those seemed to be the default in my browser (Chromium).</p>

<p>And the source of most amusement, being able to click on &#8220;in reply to&#8221; links are now all broken for me.  They simply open the video up in a new tab and loads it up fresh.  I can&#8217;t see the parent reply inline at all anymore.  Not sure why it was decided not to thread native Youtube comments as it threads Google+ based comments. (simple answer, structure and depth is not the same.)</p>

<p>Clicking on my name takes me to my empty empty profile on Youtube.  If it knows that I&#8217;m also on Google+, it would be nice if it either prepopulates my Youtube information with G+ info, or at least prominently displays where to go to see more about me (preferred).</p>

<p>Reshares in G+ show up rather awkwardly in Youtube.  It makes no visual sense and just looks like a random item or someone reposted a comment I made.  It just makes no sense to the user upon quick inspection.</p>

<p>Also&#8230; I have no clue how to reply to comments native to Youtube.  I can only assume that I <em>cant</em> because these were made before the Google+ update and any comment from now on can only be replied to if it came from an &#8220;approved&#8221; Google+ account?  If that&#8217;s the case, I can totally understand the absolute <em>outrage</em> Youtubers are feeling about the comment system.  Legacy is legacy, those still need to be functional.  I&#8217;m assuming those are blocked for replies simply because they were not able to [or purposefully] uniformly integrate the legacy youtube comments with the new style of comments.</p>

<p>It&#8217;s a harsh way to expect the huge youtube population to essentially move overnight to G+ in order to continue being able to comment and reply.  Outrage noted and approved.</p>

<p>As for execution, there is certainly much to be desired to clean it up and make it a bit more uniform and have it work smoothly.  I&#8217;m a bit disappointed that it feels really hacked on instead of built as a well integrated system with Google+ <strong>with</strong> a unified threading system.  You can&#8217;t have 2 different style of threading in one commenting system.  That&#8217;s a <em>complete</em> user experience disaster and <a href="http://google.com/+YonatanZunger">+Yonatan Zunger</a> and company should really know better.</p>

<p>It would have been so much better to do a full legacy integration and start phasing out the old Youtube profile in phases to allow the transition to happen a little more gradually as people get used to (and eventually matriculate properly with the new account).  Time pretty much makes people forget everything, and for a big change like this, rushing it with a mixed system wasn&#8217;t the most pleasant thing to do.</p>

<p>That being said, I live on G+, so I&#8217;m pretty comfortable with the controls it offers.  I don&#8217;t need to share new comments to G+, and if I do, I can limit what circles see it.</p>

<p>My profile can show or hide most information I want, so in that sense, it&#8217;s <em>sort of</em> anonymous, but certainly not as anonymous as youtube accounts were.  But that&#8217;s also part of the point.  The whole trolling aspect is completely out of hand to make the site usable for the majority.  This is a double edged sword of punishing the majority for the actions of the minority, in both situations.  A relatively small number of trolls prompt a revamp away from anonymity, a smaller G+ population forces Youtubers to have to migrate to the new network or basically be banned.</p>

<p>If Facebook owned Youtube and forced me to log in only using Facebook just to post or comment on a video, I&#8217;d certainly have doubts.  If I was a pre-migration user, I would certainly expect to be allowed a legacy account.  But seeing that the controls offered over G+ based accounts are not transferred to the &#8220;regular&#8221; Youtube comments, it&#8217;s going to be a moot point to allow continued existence and use of those legacy accounts since there&#8217;s no way to prevent the already existing trolls from still being trolls.</p>

<p>If only the system was better integrated instead of slapped on, we could be using Google+ controls to filter out what we would consider the older youtube accounts to see only the new, more relevant content.  Old users can stay where they are, but by moving, they get far better control and identification benefits.  It could have been a very tempting optional migration path.</p>

<p>The process will indeed have been slower, but it&#8217;ll be much more of a <em>transition</em> as the desire to <em>want</em> to participate can move legitimate users into a system they have more time to get familiar with and will simply leave the trolls where they are.  Or if the trolls also migrate, it makes them much easier to identify and manage via controls.</p>

<p>Overall, the concept of better accounts and the controls that come with it is undoubtedly a good one, the execution was poor.  The rough dump of users from one vastly different system to another is pretty woefully done.  This is where it&#8217;s the responsibility of the system owners to <em>transition</em>, not convert.  To take heed how to entice users to <em>want</em> to move rather than just forcing them to.  Force implies the lack of confidence in providing a service that will be transitioned to and that implication is probably far worse than what any troll could have done to both Youtube and Google+.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[media rights]]></title>
    <link href="http://subdigit.com/blog/media-rights/"/>
    <updated>2013-05-09T10:00:00-07:00</updated>
    <id>http://subdigit.com/blog/media-rights</id>
    <content type="html"><![CDATA[<div style="border: 1px solid green; background-color: #efe; padding: 5px; border-radius: 5px;">
<strong>tl;dr</strong>: Wouldn&#8217;t it me nice if we could <em>actually</em> own the rights to watch and engage with media in ways we see fit instead of being told what&#8217;s best (for them)?
</div>




<br />


<p><img class="left" src="https://lh3.googleusercontent.com/-Y-tT0-rt4h4/UYrlZ8bkoCI/AAAAAAAAF-o/Rq6NXslYT4U/w320-h232-no/fairuse.png" width="320" height="232" title="fair use" ></p>

<h3>Physical or Streaming</h3>

<p>This concept makes the rounds once in a while:  Whether it&#8217;s better to have something physical to keep and use, or to rely on a streaming service to provide for you so that you have the convenience of anytime anywhere.  Both ways have their pluses and minuses.  I probably wont exhaustively cover every aspect of it, as something like this has been written about all over the place.  I&#8217;m just going to focus on the portions of these issues that I find interesting and relevant to my needs.</p>

<p>First off, my bias is that I&#8217;m a physical disc person, not a streamer.  Oddly, it&#8217;s a contradiction, but I find at times more tedious to get things right with a streaming service than to actually have physical media in hand to leverage.  I can certainly understand viewpoints like that of <a href="http://goo.gl/UIhMe">+Sarah Price</a> who sees value in streaming where you get [almost] ubiquitous viewing on any device anywhere.  But maybe because I&#8217;m more of a home based person, I tend to usually watch things on desktop or TV.  I don&#8217;t have as strong a need for mobility as whatever is around the house is hooked up to play physical media or disk drive media.</p>

<h3>Rights and Ownership</h3>

<p>So what&#8217;s the <strong>real</strong> issue here?  It&#8217;s not <em>really</em> about disc vs streaming, it&#8217;s far more about ownership and rights and content availability.</p>

<p>I like the &#8220;extras&#8221; that are available on hard media.  I turn on subtitles for everything (they just help me grasp the story better in times of heavy dialog).  I enjoy the extra features, cut scenes, even trailers for upcoming titles.  These are all usually sacrificed on the streaming version.  I just can&#8217;t understand in this day and age why the concept of a complete package isn&#8217;t present with how streaming media is rendered.  Subtitles certainly should be an easy thing to get done.  The packaging of the extras, or lack there of, really seems like a form of punishment for wanting to &#8220;cheap&#8221; out by getting the streaming version instead of the hard media.</p>

<p>But back to the core issue.  Technically, in neither case do you actually <strong><em>own</em></strong> the movie (<a href="http://goo.gl/0Vh4d">or software</a>).  What you do have is the <em>right</em> to view it, but that&#8217;s about it.  If I wanted to watch a DVD on my Linux machine, legally, I really don&#8217;t have too many choice.  Blu-ray?  Forget it.</p>

<h4>Streaming</h4>

<p>I like that with streaming, you get that ubiquity and omnipresence of your content&#8230; to almost everything.  Well, except Linux machines cause they&#8217;re <em>so</em> insecure&#8230;  If new resolutions are available, not a problem, upgrading should be automatic.  You get the convenience, but you sacrifice control.  You lack things like accessibility, subtitles, special features.  And the company you&#8217;re renting your streaming rights from may go broke.  Then you&#8217;re left with nothing.  A reality check that you were indeed just renting the material.</p>

<h4>Physical</h4>

<p>With hard media, you&#8217;re still &#8220;renting&#8221;, but with a little circumvention, you can own your content.  Convert it to a portable media format and you have your content where ever you want.  You can take it with you on your devices, put it in the cloud and do whatever with it.  Want to preserve the whole DVD experience?  Sure.  Need to minify it for the phone?  Sure.  But it&#8217;s work.  You need to be prepared and sync your content and/or you need to host it somewhere accessible, then download it to the device.  It&#8217;s a pain for most, and an unnecessary use of disk space, but you have the control.</p>

<h3>&#8220;Owning&#8221;</h3>

<p>I strongly believe in the right to be able to watch media you&#8217;ve purchased in a way that you want, when you want, on what device you want.  With hard media, you can achieve that.  Unfortunately you break the law for that convenience since apparently it&#8217;s illegal to &#8220;have it your way&#8221;, but at least it&#8217;s possible.</p>

<p>Hence, here is my gripe with the media industry in general.</p>

<p>We&#8217;ve never bought anything since the advent of the tape and vinyl days (and probably earlier).  Not a song, not a video, not an ebook.  Nothing.  We&#8217;ve always been <em>renting</em> it.  Or rather, renting the <em>rights</em> to engage with the medium in the format you purchased the rights to.  And as such, those rights can be revoked without warning, at any time, for reasons beyond your control or even comprehension.  Look at what happened to <a href="http://goo.gl/pe1k7">Amazon&#8217;s ebook &#8220;recall&#8221;</a> from a while back.  One day you had <em>&#8220;1984&#8221;</em>, the next day it was removed from users&#8217; kindles despite having paid for the right to read it.</p>

<p>You can&#8217;t do that with a physical book or any physical media (ignore a Fahrenheit 451 scenario).  But I&#8217;m sure they would <em>love</em> to be able to enforce that.</p>

<p>Which brings me back to my long winded point.  The media companies want control.  Total and absolute control.  Which is why streaming is the best solution.  They have total and utter control over every aspect, and you get <em>none</em>.  As in absolute zero.  Yes, maybe you can rip the stream, but they do make that harder than copying a DVD.</p>

<p>If one day, they decide you no longer can stream to your iPhone because of a dispute with Apple, they can do that.  If they decide your Android phone has a screen size that&#8217;s too large to consider it a phone, they can charge you more to stream to it instead.  New 4K streaming capabilities == A new charging tier.  $4.99 not enough for 1080p, they can simply serve you 720p instead.</p>

<p>Your rights and the concept of &#8220;fairness&#8221; is of no concern.  Which is why in some sense you need to be able to protect what should have been immutable.  You paid to watch something.  In common sense terms, that implies you paid to be able to watch it when you want and how you want.  I think we deserve that much when paying for a season of TV or a movie or an album.  Technically, I think you certainly deserve that in addition to the BD, DVD, Streaming option you paid $24.99 for.  You really should have the right to reformat and repackage as your needs dictate.</p>

<p>And in some sense, I don&#8217;t think the media companies actually worry too much about the legitimate use of their media for your use.  They&#8217;re worried you&#8217;ll copy it then distribute it.  But that&#8217;s a discussion for another day.</p>

<h3>Common Sense</h3>

<p>I think that&#8217;s what&#8217;s missing here.  Common sense control abilities for my rights to view media.  I want to buy the rights to view my media in whatever way I want.  I want to be able to purchase my &#8220;rights&#8221; that allow me to view a movie how I want, when I want, where I want, using whatever I need to make it happen.  If I want subtitles, if I want special features, if I want it in 1080p or 4K or 10bit or mkv or with director&#8217;s commentary.  I simply want the ability to buy my right to do so.</p>

<p>In that case, I don&#8217;t mind paying a bit more.  But please, let&#8217;s be reasonable.  $24.99 for a BD/DVD/Streaming combo package is nice, but that really should be the upper limit for the concept.  Just give me the rights to store it on a computer, or give me the same content in streaming I have on physical media.  Just one way or the other, let me buy my rights.  I&#8217;m not saying I should have the right to <em>distribute</em> it to anyone else, I just want the right to <em>legally</em> burn a spare copy, or to rip it to my HD, or to encode a version with soft subtitle and load it onto my tablet to watch on the plane.</p>

<p>That, for now, is the reason why I still prefer my hard media.  It still offers the choices and ways I want to watch things.  Yes, it sacrifices the ubiquitous convenience of streaming, and if you&#8217;re a traveler or need to have things on the road a lot, this may just not be convenient enough for you.  But for me it is.  And for me, streaming is not that altruistic solution that&#8217;s future proofing my media, it&#8217;s simply a way to leash control onto you and relinquish you of any rights you thought you had (which you never really had in the first place).</p>

<p>Something needs to change.  We need a bit more <em>fairness</em> in this public vs big media battle.</p>

<p><span style="font-size: 0.50em; color: #aaa;"><a href="http://jacket2.org/commentary/unfair-fair-use">fbi warning image from here</a>, which I guess in it of itself is questionable if I am using it in fair use</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[authentication module]]></title>
    <link href="http://subdigit.com/blog/authentication-module/"/>
    <updated>2013-05-08T09:00:00-07:00</updated>
    <id>http://subdigit.com/blog/authentication-module</id>
    <content type="html"><![CDATA[<div style="border: 1px solid green; background-color: #efe; padding: 5px; border-radius: 5px;">
<strong>tl;dr</strong>: Run it yourself in 10 seconds flat via GitHub and Maven: <a href="http://goo.gl/bNZFw">Authentication Module</a>
</div>




<br />


<p>The <a href="http://goo.gl/f5vbe">introduction post</a> sort of served as a primer about why I wanted to create this module.  This post is going to talk about technical side of the module and for what it should (and shouldn&#8217;t) be used.  Or something like that.  We&#8217;ll see where it went once I&#8217;m done writing it.</p>

<h3>Authentication Module</h3>

<p><img class="left" src="https://lh6.googleusercontent.com/-07Wilv6PKVI/UYPlZYOb2vI/AAAAAAAAFsU/yA4O0vttMro/s268/Authentication+Login.png" width="268" height="268" title="authentication login" >
Every site that wants to deliver customized content needs a way to recognize the user.  The more customized and personal, the more likely you&#8217;ll want actual user identification rather than just plain browser recognition.</p>

<p>I figured that most sites I want to build will have some element of user identification, I may as well write a module that I can drop in and get going without having to worry too much about recreating it from scratch each time.  Thus here we are, a Java servlet based module that will allow the developer to drop in a few servlets, modify a configuration file or two, and have a bare bones site that handles user logins from a variety of 3rd party systems.</p>

<h3>Java</h3>

<p>Yeah, it&#8217;s what I like, and what I still think is pretty relevant when it comes to server side content.  I debated if I wanted to try something new, but I think for the backend, I&#8217;m comfortable with Java and it provides well in terms of support and being able to find and use libraries.  I&#8217;ll save my experimenting for front end work.</p>

<h3>Concept</h3>

<p>The idea is to have a system that will allow the developer to add 3rd party login support by trivially calling some servlets and inserting provided Javascript.  I want to get away from having to rely on some deep configuration of the host platform for user and password storage.  It just makes things too complicated since most of the time, all you really want is to know who the user is and if they have been validated so that you can get/set their preferences and create a customized experience for them.</p>

<p>I also want to have this divorced from any particular system or infrastructure so that it can just run.  No need for anything WebSphere or Tomcat or Glassfish specific or any deep configuration of LDAP or JAAS or some security module.  Just alter a property file and you&#8217;re good to go.  Now, is this the <em>right</em> way to do it?  Well, that can be debatable especially since these servlet systems do offer a lot of robust options, but I also just want to give creating this project a shot.</p>

<p>In the end, it&#8217;s meant to serve needs that I&#8217;m identifying during site creation, so that&#8217;s my driving force.  Along the way, I hope that it may be of help to others who want a bootstrap base to explore and jump from.  We&#8217;ll see how well that gets accomplished.</p>

<h3>Flow</h3>

<p>The basic idea is to:</p>

<ul>
<li>Have a screen with a bunch of login buttons.</li>
<li>Hook those buttons onto a servlet or javascript as needed.</li>
<li>Upon user click, initiate the needed redirection and prompting defined by the flow requirements of the 3rd party systems.</li>
<li>Upon proper authorization, grab the basic data returned from the 3rd party and present that information to the backend system to allow it to use it for a customized user experience.</li>
</ul>


<h3>Implementation</h3>

<p>A collection of 4 servlets, 2 of which are more core, and the other 2 slightly more optional (read: yet to be fully implemented).</p>

<ul>
<li><strong>LoginServlet</strong> - Triggers sending the browser to the official authentication page of the 3rd party system.</li>
<li><strong>CallbackServlet</strong> - Location the browser will be sent to after the user has authenticated with the 3rd party.  This is usually a registered address with the 3rd party system or passed to it as part of the initial login (automatic).</li>
<li><strong>LogoutServlet</strong> - A way to remove the current user information from the browser session.</li>
<li><strong>DisconnectServlet</strong> - A way to decouple the 3rd party system from the user.  ie. Remove authorization to leverage that 3rd party platform.
</pre></li>
</ul>


<p>Looking aside the last 2 for now (since their implementations are on the lesser scope of interest), the system really only requires 2 solid servlets to function.</p>

<h4>Login</h4>

<p>The <code>com.subdigit.auth.servlet.LoginServlet</code> instantiates the <code>com.subdigit.auth.AuthenticationHelper</code> class which is what actually handles the gritty details.  I did this with the hope that I can easily decouple the system from a specific servlet framework instance.  For now the AuthenticationHelper requires the servlet&#8217;s request and response to be passed in so that it has access to the necessary information, but I can see this evolving so that you can extract the information from any source into the AuthenticationHelper to have it behave accordingly with 0 requirement to be in a servlet environment at all.</p>

<p>The AuthenticationHelper is issued a <code>authenticationHelper.connect()</code> call to start the process.  It figures out which 3rd party system you&#8217;re calling, finds the proper class that can handle that system&#8217;s requirements (which needs to extend the <code>com.subdigit.auth.AuthentcationService</code> interface), dynamically loads it, and calls that service&#8217;s <code>authenticationService.connect()</code> method.  That method creates the URL to the 3rd party system with all the required parameters (like the application id and key) and redirects the browser to it to prompt the user to authenticate.</p>

<h4>Callback</h4>

<p>Once the user authenticates, the 3rd party system is told to callback to the <code>com.subdigit.auth.servlet.CallbackServlet</code> which instantiates another AuthenticationHelper that chains the same AuthenticationService to call the <code>authenticationService.validate()</code> method.  At this point, the system usually has an abstract token for the user, which then needs to be looked up with the 3rd party system to get the relevant details (like name, email, etc).  Each service varies how this is done, which is why we need a per-service class (See the <code>com.subdigit.auth.service</code> package) that can handle these issues per 3rd party you want to connect to the Authentication Module.</p>

<p>Once the user&#8217;s information is retrieved, the service then packages all the data it has into an <code>com.subdigit.auth.AuthenticationResults</code> object which is floated back up to the CallbackSservlet.  At the CallbackServlet level, the developer can probe the AuthenticationResults object&#8217;s various methods to access the stored information about the user.  This will then allow the developer to correlate the data in the AuthenticationResults object to an existing user in the local datastore or to create a new user.</p>

<h3>Installation</h3>

<p>Download the source from GitHub:</p>

<p><code>github clone https://github.com/subdigit/authentication.git</code></p>

<p>That should get you an <code>authentication/</code> directory.  You will need to copy:</p>

<p><code>src/main/resources/authenticationserviceconfiguration.properties.sample -> src/main/resources/authenticationserviceconfiguration.properties</code></p>

<p>And fill in the appropriate <code>.appid</code> and <code>.appsecret</code> values for the services you want to use.  It&#8217;s a hassle, but you&#8217;ll need to figure out the developer pages for the services and do the whole registration of your app there.  Some URL hints for that are on the project&#8217;s <a href="http://goo.gl/xr9lY">README.md file</a>.  Once inserted, make sure the <code>.enabled</code> is set to true for the ones you will use.</p>

<h3>Test Instance</h3>

<p>To run a test instance, be sure you have <a href="http://goo.gl/46BKN">Maven</a> installed and run:</p>

<p><code>mvn tomcat7:run</code></p>

<p>That should fire up a bare bones system on <a href="http://localhost:8080">localhost:8080</a>.  The systems you&#8217;ve enabled should show up there and you should be able to click and log into the test page with them.  Should :).</p>

<h3>Integration</h3>

<p>The servlets provided are really bare bone samples.  Take the flow in each of the goGet/doPost of the servlets and implement your own desired customizations in them.  You can probably copy the LoginServlet as is and write your own LogoutServlet for however you want to get the user logged out.  The only one where you should modify the code would be in the CallbackServlet.  Once the AuthenticationResults object is returned from the <code>authenticationHelper.validate()</code>, this would be where you need to probe the results to figure out who the user is and how they relate to your existing system (new user, existing user, etc).  At this point you will need to decide where to redirect the user to and if a new account needs to be created and so on.</p>

<p>The <code>authenticationResults.getServiceUserID()</code> will return back the primary user identifier from the 3rd party system and <code>authenticationResults.getService()</code> will let you know the 3rd party service in question.  That should be enough information to find that same user in your back end and load their information.  If they are new, you can get back some information from <code>authenticationResults.getVariable(&lt;String&gt;)</code> or get back all the parsed data via <code>HashMap&lt;String,Object&gt; authenticationResults.getDataStore()</code>.  And if you still need more information, you can get the actual object that was returned back from <code>Object authenticationResults.getReturnData()</code>.  You will need to look into the code for each service to find out what type of object is being stored.</p>

<h3>Questions</h3>

<p>If you have any questions about how to get this working, feel free to leave them here or to just <a href="http://goo.gl/j2cjL">bug me on Google+</a>.  Twitter is ok too, but the 140 character limit will just end up being frustrating.</p>

<p>Oh, and be more than free to do what you want with the code, just that if you make any changes, <a href="http://goo.gl/bNZFw">share them</a>!</p>

<p><span style="font-size: 0.50em; color: #aaa;">yeah, it&#8217;s still got a while to go, but this can be a start.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[authentication introduction]]></title>
    <link href="http://subdigit.com/blog/authentication-introduction/"/>
    <updated>2013-05-03T12:30:00-07:00</updated>
    <id>http://subdigit.com/blog/authentication-introduction</id>
    <content type="html"><![CDATA[<div style="border: 1px solid green; background-color: #efe; padding: 5px; border-radius: 5px;">
<strong>tl;dr</strong>: Logins suck.  I&#8217;m making it modular.  Plug it in here: <a href="http://goo.gl/bNZFw">Authentication Module</a>
</div>




<br />


<h3>Authentication</h3>

<p><img class="left" src="https://lh6.googleusercontent.com/-07Wilv6PKVI/UYPlZYOb2vI/AAAAAAAAFsU/yA4O0vttMro/s268/Authentication+Login.png" width="268" height="268" title="authentication login" >
I come from a corporate world of internal application development where the concept of a single, unified, user identification is handled through the official company email and corresponding backend password validation system.  So when I create an application, there&#8217;s no question or issue about how and what identity provisioning mechanism to use.  The corporate email and password ruled everything.</p>

<p>But the <em>real</em> world is a different beast.</p>

<br clear="all" />


<h3>Reality</h3>

<p>Out here, the use of a user email implies the need to register it, and therefore to create a unique password to associate with it, and I, as the application developer, now have to store that password.  It would be great if everyone picked a unique password for each site so that <em>if</em> there is a breach and the password becomes known, all that has to be done is to nuke that password and no one can get into the site.  However, that&#8217;s not how people work.  Passwords get reused&#8230; <strong>a lot</strong>.  One password to rule them all is all too common.  Combine that with a known email, and that of course spells trouble.</p>

<p>But there are certainly ways to actually store passwords securely.  You can hash and salt them to obfuscate the actual password and only care about what the password represents.  There are also numerous services out there that allow you to leverage them in order to validate a user.  You can do things like log in via Facebook, Google+, Twitter and even Mozilla&#8217;s Persona initiative.</p>

<p>All of these put the validation, verification and identity check of the user on other systems so that you can leverage their user validation infrastructure and just validate who is accessing your site without becoming the actual provisioner of the security credentials.  As a developer, less is more in this case.  Doing this completely removes the onus of password security storage back to the &#8220;other guys&#8221; and it&#8217;s one less thing to worry about.  All I need to worry about is who the user is and keep track of that information in my locally.</p>

<p>Now, are there problems this sort offloading entail?  Sure.  Your potential users need to be a member of one of the services that you&#8217;re coding against (though something like <a href="https://persona.org/">Persona</a> is trying to eliminate that as much as possible).  It&#8217;s also hard to correlate one person&#8217;s fecebook account with their google+ account unless you get something definitive to connect them together (like the underlying email address or an explicit login to associate one with another).  This may happen intentionally by people to create a new account, though that&#8217;s something already present with email based logins anyway so not much of a new issue.  It should actually be less of an issue since you can hope it isn&#8217;t as easy to create duplicate accounts on these other system (but that would be a naive assumption).</p>

<p>What&#8217;s actually worse though is the unintentional aspect duplication: poor memory.  Many a times I&#8217;ve forgotten if I&#8217;ve signed into a site via facebook, twitter, google+ or something else.  So the developer will need to take that into account as well.</p>

<p>But despite that, I think removing the onus of password storage and security <em>is a good thing</em>.  You know, just in case, not that anyone would want to breach a site <em>I</em> create :).</p>

<p>In the end, it&#8217;s more about simplicity.  I just don&#8217;t want to hassle with it.  The less I deal with sensitive material, the less likely it can be breached.</p>

<h3>New Project</h3>

<p>Hence this project: <strong><a href="http://goo.gl/bNZFw">Authentication Module</a></strong></p>

<p>The goal is to create an easily usable Java servlet base module that can be leveraged as the login mechanism for anyone developing a site.  Well, for the time being, that anyone is me, and I just didn&#8217;t want to rewrite this part for each site I wanted to create.  I&#8217;ll have a little more inner details about the project in the future, but for now, you should be able to <a href="http://goo.gl/xr9lY">run it</a> via a <a href="http://goo.gl/se58a">git</a> clone and a <a href="http://goo.gl/46BKN">maven</a> call.</p>

<p>The purpose of this module is to provide the developer with all the necessary code and routine to allow for the end user to log in via the provided 3rd party services and return back the identifying information for the user so that their information can then be stored in the application as the local user.  No more having to deal with passwords, just a return of the critical information about the user the system needs to allow a customized experience.</p>

<p>What the developer does with that information is beyond the scope of this module (I&#8217;m planning on creating a new module for that), but this will be a good jumping off point to just get going quickly.</p>

<p>I hope it&#8217;ll be useful to people.  You can check it out on GitHub and feel free to suggest any requests, fork or pull or <a href="http://www.youtube.com/watch?v=dYBjVTMUQY0">spoon</a> or whatever you like with it.</p>

<p><span style="font-size: 0.50em; color: #aaa;">security and &#8220;doing things right&#8221; are always such tough issues.  personally, it&#8217;s a thorn in my side, hence the need to modularlize and just make it easy and reusable</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[maven setup]]></title>
    <link href="http://subdigit.com/blog/maven-setup/"/>
    <updated>2013-04-18T10:30:00-07:00</updated>
    <id>http://subdigit.com/blog/maven-setup</id>
    <content type="html"><![CDATA[<div style="border: 1px solid green; background-color: #efe; padding: 5px; border-radius: 5px;">
<strong>More</strong>: My Maven based project workflow: <a href="http://goo.gl/j8K0ML">Maven Workflow</a>
</div>




<br />


<h3>Maven</h3>

<p><img class="left" src="https://lh5.googleusercontent.com/-94qdzC1_Omw/UW3O01_oMMI/AAAAAAAAFi4/dChpvlEp8M8/s200/maven.png" width="200" height="200" title="maven" >
I only recently stumbled upon <a href="http://maven.apache.org/">Maven</a> after seeing how Ruby and node.js have their respective package management systems.  Well, actually, I&#8217;ve been stumbling upon pom.xml files for a while now but it never really clicked with me what they were for.  After a <a href="http://goo.gl/TCVFH">bit of exploring</a> during a new project setup, I figured it&#8217;s time to include a bit more package management into my Java projects so that I can be a little more versed with how things are done in modern Java development.</p>

<p>So, enter the Maven setup guide.</p>

<p>I&#8217;m writing this as a companion piece to the <a href="http://goo.gl/iewvB">Java Development</a> post since the concept is going to be related.  This guide will assume some setup from that post for the basic Eclipse bootstrap, and the rest will diverge from there to help you get up and running with Maven and Eclipse and a simple project setup.  Or something like that.  We&#8217;ll see how it fares by the end of the post.</p>

<h4>Setup</h4>

<p>So here&#8217;s <em>the plan</em>:</p>

<ul>
<li>Get Maven installed on the OS and in Eclipse</li>
<li>Create a new Java project with Maven support</li>
<li>Setup the various configuration files</li>
<li>Integrate the project into Eclipse</li>
<li>Make sure the project can be run independent of Eclipse</li>
</ul>


<h4>Preparation</h4>

<p>You&#8217;ll want to get Maven installed on your OS, since part of the point of Maven is to be able to compile and run things independent of a platform (like Eclipse).  For something like Ubuntu, you can easily do:</p>

<p><code>sudo apt-get install maven</code></p>

<p>and that should do the trick.  For other OSes, you&#8217;ll have to do your due diligence to get it installed :).  For Eclipse, you&#8217;ll need these repositories.  Though technically, I think you just need the second one:</p>

<p>&#8220;Maven&#8221; : <a href="http://download.eclipse.org/technology/m2e/releases/">http://download.eclipse.org/technology/m2e/releases/</a><br />
&#8220;Maven Integration for WTP&#8221; : <a href="http://download.eclipse.org/m2e-wtp/releases/">http://download.eclipse.org/m2e-wtp/releases/</a><br />
[<a href="http://stackoverflow.com/a/12968578/223362">Source</a>]</p>

<p>With that, your system should be ready for Maven use at the OS and Eclipse level.</p>

<h4>Project Creation</h4>

<p>This is where the bizarre Maven commands come into play.  For my case, I develop web applications aimed to be run on servlets, so this is the Maven command to create a project as such:</p>

<p><code>mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp</code></p>

<p>Just run that from your project parent directory and it will eventually create a project with the specified artifactId you will provide during the prompted walk through.  In a nutshell:</p>

<ul>
<li><em>groupId:</em> Your Java package.  For me, I use something like <em>com.subdigit</em></li>
<li><em>artifactId:</em> The application package.  So I may do something like <em>testapp</em> if my project package is com.subdigit.testapp</li>
<li><em>version:</em> I usually downgrade my version to something like &#8216;0.0.1-SNAPSHOT&#8217; just for starters.  Keep the -SNAPSHOT bit as it actually as semantic meaning.</li>
<li><em>package:</em> should be fine to leave as is, as it will just mirror the groupId.</li>
</ul>


<p>And that&#8217;s it, you should now have a &#8220;testapp&#8221; directory populated with an outdated servlet web.xml.  Congrats.  Which of course means&#8230;</p>

<h4>Fix Defaults: web.xml</h4>

<p>Why the default archetype for a webapp is not up to date with modern servlet standards, I don&#8217;t know.  But it&#8217;s an easy enough fix.</p>

<p>You&#8217;ll want to update the <em>src/main/webapp/web.xml</em> from the dark ages to at least the current standard of the 3.0 framework.  So, just replace everything in there with this:</p>

<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  version="3.0"&gt;
&lt;display-name&gt;User Module&lt;/display-name&gt;
  &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
&lt;/web-app&gt;
</pre>


<p>That should give you the basics to start with.  And if you do it now, Eclipse will be much happier giving you the proper settings during the import.</p>

<h4>Fix Defaults: pom.xml</h4>

<p>For the most part, the pom file is ok.  But it could use some version updating.  The default junit version that&#8217;s hardcoded in is 3.8.1 so you might want to update it to something like 4.11.</p>

<p>You&#8217;ll also want to force Maven to use a modern JRE as the default is something rather ancient.  To do so, you&#8217;ll need to explicitly specify the JRE version you want Maven to use in the pom file&#8217;s &lt;build&gt;/&lt;plugins&gt; section:</p>

<pre>
  &lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.0&lt;/version&gt;
    &lt;configuration&gt;
      &lt;source&gt;1.7&lt;/source&gt;
      &lt;target&gt;1.7&lt;/target&gt;
      &lt;encoding&gt;UTF-8&lt;/encoding&gt;
    &lt;/configuration&gt;
  &lt;/plugin&gt;
</pre>


<p>The rest you get to have fun modifying it to your needs adding in all sorts of dependencies and whatever you need.  I wont cover that here, but you can see the pom.xml I use in <a href="http://goo.gl/3VQ0Y">this project</a>.</p>

<h4>Eclipse Import</h4>

<p>Once all the above is set, you can import it into Eclipse.  Some sites will tell you to use &#8220;mvn eclipse:eclipse -Dwtpversion=2.0&#8221; from the commandline to prepare the project, but the instructions that worked for me <a href="http://stackoverflow.com/a/10890002/223362">didnt like it</a>, so I don&#8217;t use it for my projects.  All you should need to do is:</p>

<p><code>File -> Import -> Existing Maven Projects</code><br />
[<a href="http://www.tech-juice.org/2012/05/13/hello-world-with-jsf-2-0-glassfish-3-maven-svn-and-eclipse/#Install_Eclipse_Plugins">Source</a>]</p>

<p>And just follow the prompts.  If you already updated your web.xml per the above, the Dynamic Web Module version should <a href="http://stackoverflow.com/a/9966705/223362">already be at 3.0</a>.  Which is what you want.</p>

<h4>Fix Defaults: Eclipse</h4>

<p>You&#8217;ll most likely have <em>some</em> of the directories you need, but not all of them.  Odd isn&#8217;t it.  Just go ahead and make sure you have at least these 4 directories:</p>

<ul>
<li><em>/src/main/java:</em> Java files go here</li>
<li><em>/src/main/resources:</em> Property files go here</li>
<li><em>/src/main/webapp:</em> jsps go here</li>
<li><em>/src/test/java:</em> Unit tests go here</li>
</ul>


<p>If not, you can just right click on the project and do a &#8220;New -> Folder&#8221; and create the missing ones.  Again, why they&#8217;re not already all there, I have no clue.</p>

<h4>Update Settings</h4>

<p>One thing that didn&#8217;t catch for me at times were my Maven dependencies.  Basically, with Maven, you&#8217;ll no longer be directly hosting the various dependency jars in &#8220;WEB-INF/libs&#8221;, instead they all go into a central repo on your machine that Eclipse needs to reference in its classpath.  So you need to make sure your &#8220;Maven Dependencies&#8221; are linked properly, or else you&#8217;ll end up with a bunch of &#8220;ClassNotFound&#8221; exceptions.</p>

<p>Open up your project properties, and find &#8220;Deployment Assembly&#8221;.  In that, there should be:</p>

<p><code>"Maven Dependencies" -> WEB-INF/lib</code><br />
[<a href="http://stackoverflow.com/a/9544939/223362">Source</a>]</p>

<p>If it&#8217;s not there, add it.  If it&#8217;s there, golden.  Just to make sure, you should also have your main java and resources directories pointing to &#8220;WEB-INF/classes&#8221; and the webapp directory pointing to &#8220;/&#8221;.</p>

<h3>Eclipse Independence</h3>

<p>At this point, you should be able to create your servlet, configure the web.xml or use the @WebServlet annotation and have it get registered properly (assuming you went through and <a href="http://goo.gl/iewvB">configured a servlet container like Tomcat</a>).  You&#8217;re all golden.</p>

<p>Now we need to take advantage of the whole package and independence Maven is supposed to give you.</p>

<p>Personally, I never want to have to muddy my development environment just to test out a cool project I&#8217;ve see somewhere or to run the samples of a project without the hassles of setup.  I love seeing all these node.js projects just be able to run everything from a lightweight commandline instance so that you don&#8217;t have to do any setup.  Maven also lets you do the same.</p>

<p>For me, I&#8217;m currently using Tomcat, so I would love to just have Maven be able to run my project from the commandline so that people can easily test it out without hassle.  To make that happen, you need to make sure you have a dependency in your pom.xml that points to the servlet API so that Maven can compile against it, and then you also need to have it call a server to run the compiled code on a localhost port.</p>

<p>So, for the servlet API dependency, make sure you have this as part of your pom&#8217;s &lt;dependencies&gt; section:</p>

<pre>
  &lt;dependency&gt;
    &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
    &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
    &lt;version&gt;3.0.1&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
</pre>


<p>And in your &lt;build&gt; section&#8217;s &lt;plugins&gt; area, you&#8217;ll need the Tomcat plugin installed:</p>

<pre>
  &lt;plugin&gt;
    &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
    &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;configuration&gt;
      &lt;url&gt;http://localhost:8080/manager&lt;/url&gt;
    &lt;/configuration&gt;
  &lt;/plugin&gt;
</pre>


<p>Once that&#8217;s in place, you can then call:</p>

<p><code>mvn tomcat7:run</code></p>

<p>From the commandline and voila, you <em>should</em> now see your app running on http://localhost:8080  Congratulations.  You&#8217;ve now achieved IDE independence.</p>

<p>So in theory, if you put your code up on GitHub, tell people to clone it locally, all they need to do to run it is to type the above.  No setup, no IDE needed, no hassles.  Quick and simple.  You can <a href="http://goo.gl/bNZFw">try it with my project</a> and see if it does indeed work.</p>

<h3>Notes</h3>

<p>There&#8217;s a lot I&#8217;m leaving out about Maven and pom.xml setup, but I&#8217;m just not versed enough to write about it, nor if I did, would this post be readable in length.  It&#8217;s already pretty long and talking about the nuances of the pom.xml is just way beyond this post.  Best bets: Go search for pom.xml files in GitHub and use them as examples.  I&#8217;m sure there will be a few referential ones around :).</p>

<h3>Next</h3>

<p>I think I have most of my setup complete, so I want to start concentrating on creating some projects.  You can get a peek at what I&#8217;m up to on <a href="http://goo.gl/5Pxxs">my GitHub account</a> if you&#8217;re curious.  It&#8217;s going to be a series of modules that offer some good reuse and bootstrapping for starting a user login capable website&#8230; or so I think.</p>

<p><span style="font-size: 0.50em; color: #aaa;">setup always takes so long to do.  I hope this speeds it up for some people.  At least it does for me.  Also, maven image sourced from <a href="http://www.ideyatech.com/2012/07/setting-up-maven/">ideyatech</a></span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[google+ shift]]></title>
    <link href="http://subdigit.com/blog/google-plus-shift/"/>
    <updated>2013-02-13T12:45:00-08:00</updated>
    <id>http://subdigit.com/blog/google-plus-shift</id>
    <content type="html"><![CDATA[<div style="border: 1px solid green; background-color: #efe; padding: 5px; border-radius: 5px;">
<strong>tl;dr</strong>: Fix communities by allowing simultaneous share to public and filtering circles by communities to create a semantically relevant data pipe for Google&#8217;s knowledge graph.  Or something like that.  Just read it :).
</div>




<br />


<p><img class="left" src="https://lh4.googleusercontent.com/-Qdjh3UM0CyQ/URvlbKR6-tI/AAAAAAAAEhI/PV8Ee30SxyQ/s200/google%2B.png" width="200" height="200" title="google+" >
So Google+ is an interesting beast.  It&#8217;s currently my network of choice simply because there&#8217;s content here.  I know, it&#8217;s supposed to be ghost town, but I&#8217;m just going to ignore that for another discussion.  The bottom line for Google+ is that if you&#8217;re interested in having actual conversations with people about various topics, whether it be technical or social, this is a great place to be&#8230; provided, just like any other network, you spend a little time to find the right people, pages, and now, communities.</p>

<p>But this isn&#8217;t going to be a general post about Google+.  That&#8217;s just covering way too much ground.</p>

<p>I want to focus on a particular shift I&#8217;ve noticed for Google+: <em>We&#8217;re slowly moving away from a people centric system to a topic centric one.</em></p>

<h3>People</h3>

<p>Just to get this out of the way, we still follow people on Google+ because they&#8217;re the ones that actually post things that interest us.  Just like we do in a variety of other networks and systems.  But the nice thing about Google+ is that it&#8217;s also very topic oriented.  And this can actually be a foreign thing for a lot of people, especially those coming from Facebook.  That network is much more tightly woven together by people connections (family, friends IRL, etc).  Hence <a href="http://goo.gl/y5YKr">they just can&#8217;t seem to leave it</a> since it means leaving actual people behind and having to change the paradigm of operation when entering Google+.</p>

<p>Twitter users sort of have the same problem.  Though freer than Facebook in terms of who you follow, you&#8217;re still basically following people.  You may join a hashtag conversation once in a while, but in the end, you can only do so much to continue to be with people in the same mindset.  Twitter an awesome system for quick, short, shoutouts, events, exchanges, promotions, and blurbs, but [for me at least] it&#8217;s an absolutely horrendous platform to actually converse on.  Nothing is threaded, near impossible to see anyone else&#8217;s replies, the reply-to-id is woefully underused.  No wonder they&#8217;re trying to ban a lot of 3rd party clients to try to enforce a common UX across everything.  But I&#8217;m derailing, that&#8217;s a topic for another time.</p>

<p>Google+ started itself off as a happy medium between traditional threaded conversations [like in forums] and the faster paced people oriented messaging [like in Twitter].  Coming in late, it had the time and luxury to see what worked in Facebook (connections with people are important) and what worked in Twitter (fast updates), and probably more importantly, what was missing (poor conversation tracking, lack of privacy, lack of easily expanding beyond your &#8220;[1000&#8217;s of] friends&#8221;).</p>

<h3>Topics</h3>

<p>Now as it establishes itself (<a href="http://goo.gl/G02rb">#2 social network</a>), the next step is to try to push the system slightly away from people orientation to topical orientation.  People are important still, but it&#8217;s the topics they write about that are what keep the people here.  And Communities fills that niche very nicely.</p>

<p>It helps to centralize what would have otherwise been produced in separate stream by separate people amidst all the other topics people write about.  With the introduction of Communities, people can now post their relevant content to a specific location and aggregate everything in one place.  This helps to make sure if a topic is hot, or a community is populated well, you can always find and converse with people of like interests.  That&#8217;s incredibly important for user retention.  People need to feel like they belong, and now, even the newest of users can simply just jump into a community and be instantly connected.</p>

<p>Brilliant.</p>

<p>But&#8230; <em>they got it wrong</em>.</p>

<h3>Not so fast</h3>

<p>People are not topics.  They still have a need to be known as an individual.  From a Google perspective, I think it&#8217;s easy to harvest our output into topics for others to consume and hopefully reciprocate by contributing back.  After all, what better way to extend the knowledge graph than to have great semantic data about what we post.  And it <strong>is</strong> a great benefit for all the users.  But we, as producers, still need our identity.</p>

<p>And our identity is defined by the output we produce, but the implementation of Communities fragments our outputs.  We&#8217;re now forced to choose if we should post content to our main stream, or to post content to a community.  I know that we can decide if we want our community posts to appear on our <a href="http://goo.gl/Ecyse">profile page</a>, but quite honestly, that&#8217;s a secondary place people go to for content.  The whole point of circles was to group people and listen to those circles.  And with the current setup, your community posts do not show up on your main stream.</p>

<p>So you have to choose.  Do you post to a community?  Do you post to your main stream?  Do you double post?  It&#8217;s choice we shouldn&#8217;t have to make <strong>at all</strong>.  And double posting just to make the post appear in your public stream is just a wrong waste of my time and effort.</p>

<h3>Fix it</h3>

<p>Easy fix?  Allow us to post to a community <strong>and</strong> to our Public stream simultaneously in one posting action.  I know the restrictions are in place to make sure the content publicity level and the community publicity level are accounted for, but that restriction was the easy way out (my guess is that a more robust method is being worked on, but it&#8217;s not a trivial issue).  But there&#8217;s no reason to have that restriction in place for a fully public community.  So perhaps the quick solution is to allow a &#8220;Public&#8221; share as well as a Community posting for those communities that are fully public.</p>

<p>I know there will be some strange UX issues, but quite frankly, this time, the benefits really out weighs the UX detriments of creating a special paradigm just for this one use case.</p>

<p>But you know what&#8217;s better than an easy fix?  A proper fix.  Ready?  Take notes.</p>

<h3>Go Multidimensional</h3>

<p>People are not one dimensional as circles imply.  I don&#8217;t fit into just one circle, I probably fit into several circles.  So it&#8217;s of no use to have a Circle called &#8220;Java&#8221; and putting me in there expecting I just posts about Java since surely, as the internet is the internet, I&#8217;m going to post some Cat pictures.  So with that one fell swoop, I&#8217;ve made your topical circle cluttered with junk and conceptually worthless.</p>

<p>You could follow a community instead, but all you&#8217;re given is an &#8220;Alert On/Off&#8221; system, which floods the crap out of your stream if I leave it on for large communities.  So now, you can only either get alerted for <strong>everything</strong> or you have to remember to manually go to the community.  Great, in that case communities are only theoretically useful for filtering.</p>

<p>We need to merge this concept of circles to follow people, and communities to follow topics.  You need to be able to listen to what I post when I post to a specific community.  In order for that to happen, I need to be able to make <em>one</em> post that works as a post to the community and a post to my public stream.  This type of post now essentially semantically tags my post with a topic, ie. a community.  Now all my posts are going to be semantically tagged.  Isn&#8217;t that a dandy?  And we didn&#8217;t even have to teach people to have to use hashtags or any gimmick, all part of the UX.</p>

<p>Awesomesauce.</p>

<p>Once my posts are tagged with a related community, let&#8217;s take advantage of that.  Allow us to filter a circle based on a community (or even communities).  Now you can put me in a circle called &#8220;Java&#8221;, filter it against the Java Community, and only those post I create that are also posted to the Java Community will show up in the circle stream.  [Un]fortunately, you now no longer have to ever see my Cat posts (well, that is unless you put me in a circle associated with the Cat Pictures Community).</p>

<p>We&#8217;ve now taken the first step to balance the idea of people and topics into one UX friendly concept.</p>

<h3>Progress</h3>

<p>I&#8217;m now more willing to post to a community exclusively since I know if people want to just follow me as a person, my main stream has all my content.  And for those that just want to follow one specific aspect of me, they can filter me by the communities I post to.  People will be more willing to circle me, I&#8217;ll feel the love of gaining readers, and that will encourage me to post more, it&#8217;ll encourage others to just get what they want and therefore interact more, it&#8217;s a win-win for both sides.</p>

<p>Well, for Google also since interactions go up, and we&#8217;ve most importantly started to add genuine semantic data to our posting that can be programmatically mined instead of inferred via context and content.</p>

<p>Communities now are more useful.  Circles are much more useful.  Following people is much more comfortable.  Less crud in my stream from people posting things I don&#8217;t want, but can still see the posts I do want from those same people.  Egos can be satisfied.  And we&#8217;re contributing to the I&#8217;m-sure-it&#8217;s-coming-soon Google knowledge graph search system.
people&#8217;s egos will be satisfied.</p>

<p>It feels like a win-win for both sides, topical and people oriented, for Google and the users of Google+.</p>

<p>So, make it happen.  Pretty please?</p>

<p><span style="font-size: 0.50em; color: #aaa;">Well, this got a bit long.  I can easily see what is out there now as the &#8220;quick&#8221; thing to put out.  But there are also some directions the network is taking that may indicate that I&#8217;m not quite on the same page as the developers.  Will need to dig deeper and see what&#8217;s actually there :).</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[java development]]></title>
    <link href="http://subdigit.com/blog/java-development/"/>
    <updated>2013-02-12T10:30:00-08:00</updated>
    <id>http://subdigit.com/blog/java-development</id>
    <content type="html"><![CDATA[<h3>Java</h3>

<p><img class="left" src="https://lh4.googleusercontent.com/-4OFz8ncuUBc/URlFtyTFDWI/AAAAAAAAEgc/ehXd80KYl3Y/s200/java.png" width="107" height="200" title="java" >
Look, I know there&#8217;s all these new paradigms out there for programming applications that provide useful features and <a href="http://goo.gl/TCVFH">new technologies</a>, but sometimes you still want to return to your roots and what you&#8217;re used to, just to see what it&#8217;s like.</p>

<p>I&#8217;ve been a Java programmer for a good part of a decade and a half and a lot has changed in that time.  I&#8217;ve been a bit stagnant in taking advantage of the new areas of Java, so I thought it would be time to get a fresh setup up and running so that I can tinker and take a look to see if Java can indeed compete with the rest of the pack.  But first, I need to get setup&#8230;</p>

<h3>Eclipse</h3>

<p><img class="left" src="https://lh3.googleusercontent.com/-smJQ_MiU_tk/URlFeASQiQI/AAAAAAAAEgI/56HpINNCce8/s100/eclipse.png" width="100" height="100" title="eclipse" ></p>

<p>Love it or hate it, it&#8217;s a pretty <a href="http://www.eclipse.org/">robust platform</a> that cant be ignored.  I lean more towards the love it side, but it may be simply because I haven&#8217;t really used many other integrated IDEs for Java development.  Once you have the servers hooked in, I think Eclipse can offer a good experience in terms of &#8220;just getting things done&#8221;.  But the one warning is that you really want to have enough RAM&#8230; I mean lots.  I&#8217;m comfortable with the 16GB I have, but I can see why people feel like it&#8217;s bloated (it is) when you only have 2GB of RAM to share with other apps.</p>

<p>Oh, and sometimes, it <em>can</em> feel <a href="http://goo.gl/XdGzA">downright ancient</a>, but you can easily work around that&#8230; I hope.</p>

<h4>Setup</h4>

<p>I&#8217;m currently on Ubuntu 12.10, and the default Eclipse is 3.8.  I no longer know if this is really considered Indigo or Juno, but all I know is that the newer 4.2 branch is <a href="http://goo.gl/74UvR">horribly unstable</a> and prone to a lot of crashes on Ubuntu.  I tried it, but had to revert back to the default, which I guess is the default for a reason.</p>

<p>Anyway, getting it installed and running is pretty much as easy as visiting the software center.  The fun starts when trying to get all the plugins and dependencies resolved.  For this round, here&#8217;s my goal, installed specifically in this order since I had trouble when things got out of order:</p>

<ul>
<li>Install the Google Plugin for Android development and GWT (just to play around)</li>
<li>Install GlassFish</li>
<li>Install the &#8220;Web, XML, Java EE and OSGi Enterprise Development&#8221; tools</li>
<li>Install Tomcat&#8217;s TomEE variation</li>
<li>Install EclipseLink and JPA</li>
<li>Install Maven plugin</li>
<li>Install Git plugin</li>
</ul>


<p>Now just getting them installed is a bit different from actually using them, but I just wanted to have some options setup now so that I can just try these out when I&#8217;m ready to play with them.  So, onto the installation woes.</p>

<p>All these are installed via &#8220;Help -> Install New Software&#8230; :  Add&#8230;&#8221; by adding a new plugin repository.  You can actually add them all first then do each installation if you find that easier.</p>

<h4>Preparation: Eclipse Update Site</h4>

<p>Site: <a href="http://wiki.eclipse.org/Eclipse_Project_Update_Sites">Eclipse Project Update Sites</a><br />
Repository: &#8220;Indigo Update Site&#8221; : <a href="http://download.eclipse.org/releases/indigo/">http://download.eclipse.org/releases/indigo/</a></p>

<p>For some strange reason, mine was missing the update side.  So I added it in.  Not sure if it was missing since Ubuntu is supposed to handle the updates or not, but I thought it&#8217;ll be good to have it there in case I wanted to browse it to add some extra plugins (like some of the ones below).</p>

<p>What tricked me up was that you can actually quickly see all the sites that are available to the Eclipse updater by using the dropdown arrow next to the filter box.  For some reason I wasn&#8217;t seeing that and therefore wasn&#8217;t seeing the list of installable software populated.  It would be nice to have it show everything by default, but understandably, they didn&#8217;t want to have an initial network hit fetching all that data, especially if you have a lot of sites.</p>

<h4>First: Google Plugin</h4>

<p>Site: <a href="https://developers.google.com/eclipse/docs/getting_started">Google Plugin</a><br />
Repository: &#8220;Google Plugin&#8221; : <a href="http://dl.google.com/eclipse/plugin/4.2">http://dl.google.com/eclipse/plugin/4.2</a></p>

<p>This will install things like the <a href="http://developer.android.com/sdk/installing/installing-adt.html">ADT Plugin</a> for <a href="http://developer.android.com/index.html">Android development</a> (you still need to have the SDK installed, which you can find instructions for <a href="http://developer.android.com/sdk/index.html">here</a>).  It also adds support to be able to play with <a href="https://developers.google.com/web-toolkit/">GWT</a> which is a nice addition.  Not sure if I will, but it&#8217;s on the list of things I want to take a look at.</p>

<p>After a bit of experimenting, this plugin has to go first.  If I install it later, it complained about some ant dependencies that just wouldn&#8217;t resolve themselves.  The joy of dependency hell.  But install it first and no problems.</p>

<p>The plugin comes in a 3.7 flavor also, but use the 4.2 variety.  I think 3.8 is really almost the same as 4.2, just without the UI makeover.</p>

<h4>Second: Glassfish</h4>

<p>Site: <a href="http://glassfish.java.net/">GlassFish</a><br />
Repository: &#8220;GlassFish&#8221; : <a href="http://download.java.net/glassfish/eclipse/indigo">http://download.java.net/glassfish/eclipse/indigo</a></p>

<p>GlassFish is basically the reference Java EE server produced by Oracle to support and showcase the standard.  I figured it should be a good one to have and use, especially since it came as a complete package with the Apache Derby DB.  Why not.</p>

<p>Once you load up the repository, you should see a &#8220;GlassFish Application Server&#8221; entry.  Go through all the hoops, restart Eclipse, and end up back at the Install New Software section.  I figured it&#8217;s pretty heavy duty and the dependency chain it installs will get a lot I&#8217;ll need later on installed.</p>

<p>Note: I&#8217;ve had the repository fail on me from time to time, so alternatively, you can use the Eclipse Marketplace to get Glassfish installed.  There&#8217;s a good instructions set on <a href="http://www.tech-juice.org/2012/05/13/hello-world-with-jsf-2-0-glassfish-3-maven-svn-and-eclipse/#Installing_Glassfish_Support">Tech Juice</a>.</p>

<h4>Third: Web/XML/Java EE Tools</h4>

<p>Repository: &#8220;Indigo Update Site&#8221; : <a href="http://download.eclipse.org/releases/indigo/">http://download.eclipse.org/releases/indigo/</a></p>

<p>I also loaded from the Indigo Update Site: &#8220;Web, XML, Java EE and OSGi Enterprise Development&#8221; tools.  But without the &#8220;PHP Development Tools (PDT) SDK Feature&#8221; and &#8220;Rich Ajax Platform (RAP) Tooling&#8221;.  Not 100% sure why, but just followed the instructions from a <a href="http://lackovic.wordpress.com/2012/05/31/set-up-eclipse-and-tomcat-7-on-ubuntu-12-04-to-create-java-restful-web-services-with-jersey/">Tomcat installation post</a>.  I figured they know what they&#8217;re doing and I&#8217;m not a PHP person anyway so no loss there.</p>

<h4>Fourth: TomEE</h4>

<p>Site: <a href="http://tomee.apache.org/">TomEE</a> [<a href="http://tomcat.apache.org/">Tomcat</a>]</p>

<p>Like GlassFish, TomEE is a full service stack.  It&#8217;s basically Tomcat with the added modules to make it into a full Java EE stack.</p>

<p>This one you need to go download and install manually.  We&#8217;re simply going to associate Eclipse with the freshly installed server.  So, go <a href="http://tomee.apache.org/downloads.html">download TomEE from Apache site</a> (I got the Plus version).  Then just &#8220;tar xfvz&#8221; it somewhere you like (I put it in /opt).  It will need to be owned by the same user that will be initiating Eclipse in order to allow for file changes, so I just &#8220;chmod -R&#8221; to my user and group.</p>

<p>The instructions are nicely <a href="http://tomee.apache.org/tomee-and-eclipse.html">laid out on the site</a>.  If you already have a project, you can use the &#8220;Quick Start&#8221;, else it&#8217;s not too much of a hassle to do the &#8220;Advanced installation&#8221;.  The only difference for me was that I couldn&#8217;t find the &#8220;Modules auto reload by default checkbox&#8221;.  I changed the ports to +2 everything since I&#8217;m letting GlassFish run on port 8081 (a +1 from the default 8080).  That way it wont interfere with my system&#8217;s default web server.</p>

<p>I opted to let Eclipse manage this instance of Tomcat so I set the preference to &#8220;Use Tomcat installation&#8221;.</p>

<p>When doing the server association, you can actually tell the system do go download Tomcat for you.  I guess that way you can have a completely managed Tomcat instance via Eclipse, and all you would need to do is to add the additional libs/wars to turn it into a TomEE instance.  I just opted to install my own separate instance and hook it in, but let me know if you&#8217;ve done otherwise.</p>

<h4>Fourth.5: GlassFish configuration change</h4>

<p>Just a note.  I hate crappy directory layouts.  And GlassFish creates a top level directory in your workspace for its server.  However, once you install TomEE, it puts it&#8217;s server information in a &#8220;Servers&#8221; directory, like it should.  So to fix this, I do a little cleanup to move the GlassFish server directory to the proper Server directory.</p>

<p>To do this, Open up the &#8220;Server&#8221; view, which should be showing a GlassFish server.  Double click it and find the Domain Directory entry.  Before hitting &#8220;Browse&#8221;, I copied the &#8220;glassfishdefaultserverlocalwhateverthislonguglynameis&#8221; directory to something like &#8220;Servers/GlassFish-3.1.2.2&#8221;.  Once I have that, I hit &#8220;Browse&#8221; and simply selected that new directory and deleted the old one.  All nice and clean.</p>

<p><em>Configuration Note</em>: For some reason, I cant unlock the server port to edit it via the provided interface in Eclipse (when you double click on the GlassFish server).  But you can do it manually by going to the GlassFish server directory (the one I changed to &#8220;Servers/GlassFish-3.1.2.2&#8221;) and editing the <code>config/domain.xml</code> file and finding the entry for the
One note, anyone know how to change the default port on GlassFish?  The Server and Admin Server Port entries are locked for me&#8230;
/config/domain.xml change:</p>

<p> <code>&lt;network-listener port="<strong>8080</strong>" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"&gt;&lt;/network-listener&gt;</code></p>

<p> to</p>

<p> <code>&lt;network-listener port="<strong>8081</strong>" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"&gt;&lt;/network-listener&gt;</code></p>

<p>And that should do it.  If you want to also run a stand alone version of GlassFish, you should probably go ahead and +1 all the other <code>&lt;network-listener&gt;</code> ports so that there wont be any conflicts.</p>

<h4>Fifth: EclipseLink and JPA</h4>

<p>Site: <a href="http://www.eclipse.org/eclipselink/">EclipseLink</a><br />
Repository: &#8220;EclipseLink&#8221; : <a href="http://download.eclipse.org/rt/eclipselink/updates/">http://download.eclipse.org/rt/eclipselink/updates/</a></p>

<p>EclipseLink allows you to easily use the Java Persistence APIs (JPA) to connect and pass objects to and from a data store.  Well, so they say.  I have yet to try it so we&#8217;ll see how easy it really is :).</p>

<h4>Sixth: Maven</h4>

<p>Site: <a href="http://maven.apache.org/">Maven</a><br />
Repository: &#8220;Maven&#8221; : <a href="http://download.eclipse.org/technology/m2e/releases/">http://download.eclipse.org/technology/m2e/releases/</a><br />
Repository: &#8220;Maven Integration for WTP&#8221; : <a href="http://download.eclipse.org/m2e-wtp/releases/">http://download.eclipse.org/m2e-wtp/releases/</a></p>

<p>Maven&#8217;s the super ugly cousin of npm, gem, other modern dependency package management system.  But I guess it works once you get the hang of it.  I have yet to get the hang of it, but would like to, hence I&#8217;m installing it.</p>

<p>You can find more detailed installation and project setup instructions on this companion post: <a href="http://subdigit.com/blog/maven-setup/">Maven Setup</a>.</p>

<h4>Seventh: Git</h4>

<p>Site: <a href="http://www.eclipse.org/egit/">eGit</a><br />
Repository: &#8220;Git&#8221; : http://download.eclipse.org/egit/updates</p>

<p>And Git, or eGit, jGit, whatever.  It&#8217;s basically git.  Everyone seems to love <a href="http://git-scm.com/">git</a> (and thus <a href="https://github.com/">GitHub</a>).  I&#8217;m <a href="http://goo.gl/se58a">learning it</a>.  So I may as well jump on the band wagon.</p>

<p><strong>Warning:</strong> Of course, the natural progression is to want to install the <a href="http://eclipse.github.com/">GitHub plugin</a>.  YMMV, but I couldn&#8217;t get it to work.  In fact, it bricks my entire Eclipse installation and I had to clean out and reset my Eclipse back to the default and redo all the steps.  I have no clue what went wrong, why, or how to fix it, but it&#8217;s borked me enough times to stay away from it for now.</p>

<p>At first when I tried to install the GitHub plugin (<a href="http://eclipse.github.com/">Site</a>, <a href="http://download.eclipse.org/egit/github/updates">Repository</a>), it complained that I needed Mylyn installed.  So I tried to install Mylyn (<a href="http://www.eclipse.org/mylyn/">Site</a>, <a href="http://download.eclipse.org/mylyn/releases/latest">Repository</a>), but it complained that I needed Subclipse installed.  So I installed Subclipse (<a href="http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA">Site</a>, <a href="http://subclipse.tigris.org/update_1.8.x">Repository</a>), then Mylyn, then GitHub, then Eclipse would no longer restart.  Had to nuke it all.</p>

<p>But do let me know if you can get it working&#8230;</p>

<h3>Cleanup</h3>

<p>So, speaking of nuking, sometimes, something will just go wrong and you need a fresh start.  I&#8217;m not quite sure what to do about projects that got configured with important information, but I had a clean slate from the beginning, so I didn&#8217;t have to worry about relinking projects.  If you need a clean Eclipse slate, because something like GitHub borked your installation, here&#8217;s some of the directories to clear out:</p>

<ul>
<li>Remove the version of eclipse that you are using from ~/.eclipse</li>
<li>Remove the <workspace>/.metadata directory.</li>
</ul>


<p>Pretty easy, but again, be warned, if you already have established projects and you do this, the meta information about your project will be lost and you&#8217;ll have to re-import them back into Eclipse.  I was on a clean slate so not too many worries for me.</p>

<h3>Startup Errors</h3>

<p>I&#8217;ve noticed that at times I&#8217;ll get a message during startup complaining &#8220;An error has occurred.  See the log for more details&#8221;.  And that&#8217;s it.  No more eclipse.  The log is equally unhelpful complaining about some sort of OutOfMemory error.</p>

<p>I found <a href="http://joerglenhard.wordpress.com/2012/03/24/eclipse-an-error-has-occurred-see-the-log-file-metadata-log/">this article</a> which alleviated the problem by calling eclipse with the -clean flag:</p>

<p><code>eclipse -clean</code></p>

<p>Which seems to allow start up of Eclipse with no detrimental effects.  No clue why, and neither did the author of the post know.  But so long as it works, may as well leave that tidbit here.</p>

<h3>Notes</h3>

<p>Even though both GlassFish and TomEE are installed and runnable simultaneously, unfortunately you have to associate your project during creation time to one or the other.  Which means you cant just plop a Glassfish project into TomEE and visa versa.  But perhaps with some manual XML hacking, it can be switchable once you create it.  I just haven&#8217;t gotten around to that level yet, and probably wont.  But it&#8217;s good to have either available to play around with and see what&#8217;s going on.</p>

<h3>Next</h3>

<p>Now that I&#8217;m all Java setup, I&#8217;ll probably start taking a look at some of the <a href="http://goo.gl/iqJL5">newer frameworks</a> and see what they offer.  Things like <a href="http://www.sparkjava.com/">Spark</a>, <a href="http://britesnow.com/">Britesnow</a>, <a href="http://www.playframework.com/">Play</a>, <a href="https://vaadin.com">Vaadin</a>, <a href="http://portals.apache.org/jetspeed-1/">Jetspeed</a>, <a href="http://jersey.java.net/">Jersey</a> and even older ones like <a href="http://www.hibernate.org/">Hibernate</a> and <a href="http://www.springsource.org/">Spring</a>&#8230; maybe.  In the end, I want to see if modern Java development is up to snuff to compete with the <a href="http://goo.gl/TCVFH">newer frameworks</a>.</p>

<p>As a preview, my next task would be to get a bit more of an understanding of <a href="http://www.oracle.com/technetwork/java/javaee/tech/persistence-jsp-140049.html">JPA</a>, which I&#8217;ll be experimenting with via <a href="http://connectedweb.wordpress.com/2012/12/20/ubuntu-jpa-with-eclipse/">this set of instructions</a>.  But experimenting early on, I&#8217;ve already run into <a href="http://www.eclipse.org/forums/index.php/mv/tree/452459/#page_top">a problem</a>, so hopefully I can get around it (and I&#8217;m sure others) after a deeper dive.</p>

<p><span style="font-size: 0.50em; color: #aaa;">Sometimes I cant tell Java is really the standout in terms of diversity and functionality or if I&#8217;m just used to it.  Everything else feels pretty lacking in structure and organization.  But I&#8217;ll see if there&#8217;s something out there that can compare.  It is bloated, but there&#8217;s quite a lot out there for pretty much anything you want to do.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[extractor development diary]]></title>
    <link href="http://subdigit.com/blog/extractor-development-diary/"/>
    <updated>2013-01-29T15:10:00-08:00</updated>
    <id>http://subdigit.com/blog/extractor-development-diary</id>
    <content type="html"><![CDATA[<p><img class="left" src="https://lh6.googleusercontent.com/-Omt2ERPojyQ/UMT8vLqY-eI/AAAAAAAAD8k/xMfq7QupQk0/s128/urlextractor.png" width="128" height="128" title="url extractor" >
Development, as straightforward as it may seem, is never as straightforward as you would like it.  Often times, you have an idea in your head.  You know where you want to go. You even have the general gist of how to get from point A to point B (if you&#8217;re lucky).  But the road to get there is never quite as straight as planned.  The <a href="http://goo.gl/TbEOj">URL Stats Extractor</a> was definitely one of those experiences.</p>

<h3>Chrome Extension</h3>

<p>So, I wanted to do a simple chrome extension that showed me the stats for goo.gl based shortened URLs.  Mainly for my own want in keeping track of links I&#8217;ve created, but also to see how popular other links can be.  Plus the main <a href="http://goo.gl">http://goo.gl</a> site is, how can I say it nicely, &#8220;lacking&#8221; in any modern website features.  It&#8217;s pretty crappy and you cant do a search nor reorder the links nor even actually delete anything, just hide it.  <strong>But</strong>, it does have a robust API.</p>

<p>Almost forgivable.</p>

<p>I chose a Chrome extension simply because that&#8217;s my current browser of choice.  It&#8217;s robust, the tools are there, and lots of good guides.  So why not.</p>

<h3>The Idea</h3>

<p>Back to the extension.  The plan was to create an extension that would find all the shortened URLs on a page and give you back some information about them.  I didn&#8217;t want to  permanently visually disrupt the page since there&#8217;s a lot of sensitivity with layouts and structure and widths and heights and so.  So I opted to go with a popup.  The plan was on a mouseover, the popup would trigger, hit the API, fetch the information, render the data, and show you a nice bubble.  Simple.  Yes&#8230; <em>simple</em>.</p>

<h3>Preparation</h3>

<p>First things first.  I needed to remind myself how to <a href="http://developer.chrome.com/extensions/overview.html">develop an extension</a>.  I often find <a href="http://developer.chrome.com/extensions/content_scripts.html">examples to be invaluable</a> to get a kickstart in the right direction.</p>

<p>Of course, I needed the reference for the <a href="https://developers.google.com/url-shortener/v1/getting_started">goo.gl API</a> and do all the signup needed to get developer keys and so on.  Pretty easy.  Wasn&#8217;t even tedious.</p>

<p>I chose to just shove jQuery into the extension so that I can leverage it for my DOM manipulation and that would then allow me to plugin the various popup libraries people write against jQuery, which I was hoping would help move things along.  More on that in a bit.</p>

<p>I&#8217;ll mention this now even though I ended up retrofitting this after I wrote the extension, but <a href="https://plus.google.com/102618867576885719554/posts">Alex Wolkov</a> has a nice site called <a href="http://extensionizr.com/">Extensionizr</a> (found via <a href="https://plus.google.com/102618867576885719554/posts/3xE9stNrreu">this thread</a>).  It&#8217;s a quickstart way to get a Chrome extension bootstrap setup and configured nicely, especially for future expansion.</p>

<h3>Research</h3>

<p>Two simple things left to figure out:</p>

<ul>
<li>Find out how to embed a mouseover trigger where I need.</li>
<li>Find a nice popup library.</li>
</ul>


<h4>Mouseover</h4>

<p>For the mouseover, I could either find all the anchors and see if the URL is one I can analyze, or I could continuously figure out where the mouse is, find the word under there, and determine if that&#8217;s a URL I can show stats for in that spot.  The first method will find all the hyperlinks on the page and allow me to analyze them so that I can embed trigger points.  But it will miss non hyperlinked URLs that appear in plain text.  The second method can be made to work with any kind of text, but the complexity required to figure out the underlying code and to see if an anchor surrounds it all with a suitable link was a bit daunting.</p>

<p>For this project, the first method was fine.  Something from <a href="http://stackoverflow.com/questions/2444430/how-to-get-a-word-under-cursor-using-javascript">stackoverflow</a> pointed me in the right direction.  I ended up simply finding all the &lt;a&gt; tags, grabbing the href from them, and analyzing it to see if it&#8217;s something the extension understands.  If it did, I would embed a class on that anchor, which I would later use as the trigger point for the popup.</p>

<p>I only mention the second method since something like that could be really interesting to use for some other word-on-a-page analysis type thing.  I started down the road of dissecting the <a href="https://chrome.google.com/webstore/detail/rikaikun/jipdnfibhldikgcjhfnomkfpcebammhp/details?hl=en">Rikai-kun extension</a> [<a href="http://code.google.com/p/rikaikun/">sourc code</a>, but it was actually far more complex than I imagined so I put that on the back burner.  It was overly complex for what I needed for this extension anyway, and it actually didn&#8217;t quite solve the problem nicely, so tucked away for a future project.</p>

<h4>Popup</h4>

<p>There&#8217;s dime a dozen of these out there.  So it shouldn&#8217;t have been hard to find one that works right?  <em>right</em>?  Turns out, it&#8217;s was a touch difficult.</p>

<h5>Akita</h5>

<p>I started out by asking for any <a href="https://plus.google.com/u/0/107762004876412812922/posts/V49mtoZaXv6">recommendations</a> and came back with something from <a href="https://plus.google.com/u/0/113672047888462875267/posts">Paul Yaun</a> call <a href="http://www.paulyuan.ca/akita/">Akita</a>.</p>

<p>It worked fine with a few tweaks.  Namely I had to catch the hover event myself then force open and close the tooltip based on entering and exiting the hover.</p>

<pre>
$('a.' + MARKER_CLASS).hover(
    function() { triggerExpand($(this)); },
    function() { clearExpand($(this)); }
)
</pre>


<p>I then triggered the popup in triggerExpand:</p>

<pre>
var speechBubble = $.akita.show({element: $(link)[0], content: output});
</pre>


<p>After that I went and ajax fetched the dynamic content.  Just like planned&#8230; except it didn&#8217;t work inside of Google+, which is my primary target since the goo.gl shortener is used well in there (well, at least by me).  Normally these extensions are usually run in a clean environment that you can control when building, you can manually resolve CSS conflicts and issues by adjusting your styles in interfering classes.  But seeing that an extension is an injection, that would mean I&#8217;d have to analyze how and what Google+ was doing that was interfering with the extension.  As fun as that could be (sarcasm?), I figured these popup libraries are dime a dozen, so time to move to the next one.</p>

<h5>Tiptip</h5>

<p>Up next was <a href="http://code.drewwilson.com/entry/tiptip-jquery-plugin">tiptip</a>.  Although there hasn&#8217;t been a new version since 2010, it seemed stable and light enough.  I plugged it into my test env, and it worked fine.  I even plugged it into the extension, and it actually worked on Google+, awesome.</p>

<p>But&#8230; it didn&#8217;t have the ability to fetch dynamic content&#8230; which was a deal breaker.</p>

<p>However, in the forum for the plugin, someone provided a patch that allowed the passed in content variable to either be <a href="http://drew.tenderapp.com/discussions/tiptip/88-patch-for-dynamic-content">a string or a function</a>.  Which meant that I can now pass in dynamic content via a delayed function call.  Yay.</p>

<p>I applied the patch and now I could generate my own content on the fly.  And I could now place a &#8220;fetching&#8230;&#8221; wait marker as the dynamic content got loaded.</p>

<p>Almost there.  The next hurdle was with acquiring the context of the anchor point.  Since I hacked on an async call to get data, once that data returned, it needed to know the context of the location, which is something the original plugin didnt really need.  The patch didn&#8217;t take that into account, but it was easy enough to muck with the source to allow it to pass in the reference to the original element (already in a variable called orig_elem).</p>

<p>Ok, more problems, but more solutions.</p>

<p>That actually worked fine.  The tooltip worked and showed the content properly, except that the default location was on bottom.  A browse of the config for tiptip and got it showing on the top&#8230; then things broke&#8230; of course.</p>

<p>The triangle anchoring the content to the anchor element was shoved in the middle of the multilined popup.  Ugh.  So this popup only works well if the anchor was on the bottom.  Great.  Nix that.  Onto the next.</p>

<h5>Bootstrap</h5>

<p>Fun.  So I figured, hey, maybe a well established system like <a href="http://twitter.github.com/bootstrap/">Bootstrap</a> could be the solution.</p>

<p>Awesome, this should be good.  Docs looked fine. Supported dynamic content right off the bat (though wasn&#8217;t sure about the proper reference passing).  However, it failed the Google+ injection test (seriously Google+, what the hell is in your css/javascript mojo for the site&#8230;).  It would only do an awkward partial render, obviously the elements of Google+ interfering.  I tried both tooltip and popover, and neither went well.</p>

<h5>Back to Tiptip</h5>

<p>So back to Tiptip.  I guess a bottom tooltip will be good enough for now.  I was getting tired of over exploring and just wanted to see something working that I could actually use.</p>

<p>As I was writing the notes for this post, it became clear that the location of the anchor bit was actually correct, but the content of the tooltip had expanded too low due to the addition of the new dynamic content, which was a multiline thing as compared to the initial placeholder text (&#8220;fetching&#8230;&#8221;) on which all the calculations were made.</p>

<p>The top of the bubble was calculated based on the initial content, not the new content.  Sigh.</p>

<p>All these weird little issues may explain why the async patch pushed to the git repo of tiptip never got integrated because the rendering mechanism just wasn&#8217;t compatible with dynamic content.</p>

<p>So the question now was to see if I could make the container re-render upon return of the new content, or if I could fix the calculations to make them truly dynamic, or if I should switch to <em>syncronous</em> ajax calls and return the full data right then and there so that the system can get that back right away.</p>

<p>For now, I&#8217;m switching from $jQuery.get to $jQuery.ajax and passing in an &#8220;async: false&#8221; flag to force the fetch to complete first.  I figured the call should be pretty quick so not much lockup to worry about.</p>

<p>That finally did it.  All the parts working well enough to warrant actual use.  Not pretty, but working at least.</p>

<p>Presenting, the <a href="http://goo.gl/G7dGb">URL Stats Extractor</a>.
Complete, with <a href="http://goo.gl/wovYL">GitHub source</a>.</p>

<h3>Todo</h3>

<p>Things to do?  Import in the pretty graphs from the goo.gl page as part of the display (or just a new display interpretation other than just text).  And I need to dynamically detect how much space is available above the tooltip and switch it from top to bottom as needed.  Though I think that should really be in the realm of the plugin code so I shouldn&#8217;t have to muck with it.  That and perhaps exploring the tooltip landscape a bit more and finding something I can use without any modifications.</p>

<p>Also I need to figure out how to detect when new content gets loaded onto a page, like in the case of Google+, so that the extension can rescan for links and do the proper insertions.</p>

<p>Oh, and the extension is using the new 2.0 manifest version, so there&#8217;s a Content Security Policy that&#8217;s being reported about a base64 image being loaded&#8230; except that I don&#8217;t use base64 images and I can&#8217;t seem to find what base64 image is being loaded and what&#8217;s loading it&#8230;  I&#8217;m suspecting it&#8217;s somewhere in the jQuery code, but I just cant seem to figure it out.  For now it&#8217;s not a show stopper, just an annoyance present in the console, so not too bad.  But I&#8217;d like to see it go away for good.</p>

<p>Eventually, I could probably extend this to include bit.ly, is.gd or whatever other shorteners are out there, but perhaps that could be something anyone willing enough can pull from the <a href="http://goo.gl/wovYL">git repository</a> and contribute :)</p>

<p><span style="font-size: 0.50em; color: #aaa;">this is one of those projects where you did it quickly enough over a few days to get it functional 80% of the way, not sure if I have the dedicated energy to take it the rest of the 20%.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ruby ssl]]></title>
    <link href="http://subdigit.com/blog/ruby-ssl/"/>
    <updated>2013-01-22T12:00:00-08:00</updated>
    <id>http://subdigit.com/blog/ruby-ssl</id>
    <content type="html"><![CDATA[<h3>ngmodules</h3>

<p><img class="left" src="https://lh6.googleusercontent.com/-0dG7-8Dp3rw/UP7CmibHlNI/AAAAAAAAEOI/sDY1JFAgZUw/s200/ruby.png" width="200" height="200" title="Ruby" ></p>

<p>In my <a href="http://goo.gl/TCVFH">tech explorations</a>, I had stumbled across this <a href="http://ngmodules.org">AngularJS Modules collection project</a> which I thought was a neat project.  Written in <a href="http://www.ruby-lang.org/">Ruby</a>, it&#8217;s basically a simple way for people to add their AngularJS modules and to list and search for useful modules.  I am by far not at all versed in Ruby, which made this something I was not familiar with.  But thought it would be an interesting exercise get this running locally and to take a peek under the hood of a simple Ruby project that presented the whole stack.</p>

<p>The site came with a pointer to its <a href="https://github.com/jimrhoskins/ngmodules.org">GitHub repo</a>, complete with a Readme.md outlining the steps needed to get it running locally.  Well documented and clear instructions, what&#8217;s not to love about that.</p>

<h3>Installation</h3>

<p>Scanning the list of requirements, there were things I didn&#8217;t yet have installed on Ubuntu 12.10, so off I went.  I had to install <a href="http://www.postgresql.org/">postgresql</a> (<code>sudo apt-get install postgresql</code>) and <a href="http://pygments.org/">pygments</a> (<code>sudo apt-get install python-pygments</code>) but since I already had ruby installed (due to <a href="http://octopress.org/">octopress</a>), the rest of the instructions worked out well.</p>

<p>With everything installed and built, all that was left was to hit the big old button (or rather command line: <code>bundle exec rails server</code>) and see it in action.  For once, it amazingly worked right out of the box.  I now had a nice clone running on localhost:3000.  All happiness and fun times&#8230; until I hit the &#8220;Login with GitHub&#8221; button.</p>

<p>It <em>almost</em> worked.</p>

<h3>Problems</h3>

<p>But as we all know, almost isn&#8217;t quite good enough.  I was greeted with an SSL error:</p>

<p><code>
Faraday::Error::ConnectionFailed</br>
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
</code></p>

<p>A security issue, oh fun.</p>

<h3>Solutions</h3>

<p>I had to do a bit of digging to find out that it was some sort of Ruby configuration issue with SSL and localhost and forced certificate checking.  After a bit of searching and probing for answers, I was led to this answer on StackOverflow: <a href="http://stackoverflow.com/a/11041204">http://stackoverflow.com/a/11041204</a></p>

<p>Though <a href="http://stackoverflow.com/a/597375">another answer</a> that had worked in the interim was to use prepend the Ruby command with the <code>SSL_CERT_FILE</code> environment variable and have that point to the downloaded cacert.pem file, wherever you put it.  Something like this:</p>

<p><code>
SSL_CERT_FILE=/etc/ssl/certs/cacert.pem bundle exec rails server
</code></p>

<p>Useful if you can&#8217;t reinstall and rebuild Ruby for some reason.  With that in place, the callback from GitHub worked fine and I was able to log in with my credentials.  The last hurdle was crossed and I <em>finally</em> had a working clone of the project locally.  Now I&#8217;ll can take  a little bit of time and explore the code and see how it was built.</p>

<h3>Next</h3>

<p>I&#8217;m still deciding if Ruby is something I want to jump into and learn or something to bypass in favor of writing backends in Javascript for <a href="http://nodejs.org/">Node.js</a> or to simply see if Java has made any packaged advances in this area (without the daunting complexity of WS-* services and the usual overblown nature of Java).</p>

<p>But for those that are in Ruby land, I figured others may have had the same issue so I&#8217;d post it here in case.  Ah, the internet, such a nice place to hang out.</p>

<p><span style="font-size: 0.50em; color: #aaa;">I couldn&#8217;t decide if this post should be part of the <a href="http://goo.gl/NqQpV">Ubuntu 12.10 quirks post</a> or something to stand on its own.  It ended up being pretty long, so I gave it its own post.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[technology exploration]]></title>
    <link href="http://subdigit.com/blog/technology-exploration/"/>
    <updated>2013-01-17T12:00:00-08:00</updated>
    <id>http://subdigit.com/blog/technology-exploration</id>
    <content type="html"><![CDATA[<h3>Exploration</h3>

<p><img class="left" src="https://lh5.googleusercontent.com/-IEAAWPkcCYQ/UPga9OvI-vI/AAAAAAAAEMs/XIFh8kraPyM/s300/enterprise-tos.jpg" width="300" height="188" title="Enterprise NCC-1701" ></p>

<p>Starting a new project is daunting, especially when you only have a general idea about what you want to do.  But it&#8217;s also a great time to explore and check out the new toys out there.</p>

<p>I&#8217;m predominantly a Java programmer.  So I&#8217;ve been accustomed to working through my typical stack of tools to get things done.  A nice relational database, some ORM layer to access the database, a servlet layer, a web layer to produce APIs and web compatible objects, and then all the front end magic to put it together for the end user.</p>

<p>It&#8217;s been all nice and dandy, but at some point, you need to sit back and wonder if you&#8217;re still on the right track&#8230; or rather, the most efficient track not just for development, but also just for the sake of keeping your toolset sharp and being cognizant of the new ways of doing things out there.</p>

<p>So, I was thinking about taking a bit of a break from the traditional way I do things to see what I can explore out there to help me learn something new and interesting.  Something to get me nicely ramped up and eliminate all those bottlenecks I used to run into.  It couldn&#8217;t hurt to look right?  Just to see what new things are available that could help me out?</p>

<p>It turned out to be a far bigger, faster, more complex world out there than I thought.</p>

<h3>Findings</h3>

<h4>Databasing</h4>

<p>There&#8217;s the whole NoSQL movement, which I&#8217;m still convinced is more akin to &#8220;T-don&#8217;t-like-SQL-so-I-want-some-other-query-system&#8221; rather than a genuine improvement.  The plus side is that these new tools have been built in the age of web applications and public APIs so usually everything is geared and ready to just be jsonized from the start.  Some popular databases here are things like <a href="http://www.mongodb.org/">mongoDB</a> and <a href="http://couchdb.apache.org/">CouchDB</a>, with which you can apparently pair <a href="http://pouchdb.com/">PouchDB</a> for offline databasing.  Interesting.</p>

<h4>Server side</h4>

<p>There&#8217;s the whole <a href="http://nodejs.org/">Node.js</a> movement, which is nifty, albeit having seen where Javascript came from, makes me cringe to think how core of a language JS is becoming even on the server side.  But apparently performance of <a href="http://www.ziggytech.net/technology/web-development/experiences-with-node-js-porting-a-restful-service-written-in-java/">node and its plugins</a> can be tuned to achieve something on par to a traditional Java stack.  That&#8217;s at least a good start.</p>

<p>Though that&#8217;s not saying too much since the Java stack was never the fastest horse in the stable, it was just the most robust one.  The other neat thing about Node is that there&#8217;s a robust plugin environment for it.  Lots of extra tools and tidbits to add prebuilt layers and reduce complexity.  End point and service generation plugins like <a href="http://expressjs.com/">Express</a> and an interesting upcoming one called <a href="http://walmartlabs.github.com/hapi/">Hapi</a>, built by one of the OAuth authors, <a href="http://hueniverse.com/2012/12/hapi-a-prologue/">Eram Hammer</a> sound pretty interesting.</p>

<h4>Packaging systems</h4>

<p>Deployment, packaging, preparation, compression, parsing, aggregation and all that complex/tedious but necessary stuff.  Things like <a href="https://npmjs.org/">npm</a> and <a href="http://gruntjs.com/">grunt</a> help build and put things together.  There&#8217;s the whole standalone <a href="http://twitter.github.com/bower/">Bower</a> package repository that you can pull from and keep your libraries up to date.  Lots of tools and utilities out there to help put things together and get them to places like <a href="http://www.heroku.com/">Heroku</a> and <a href="https://developers.google.com/appengine/">AppEngine</a>.</p>

<h4>Client side</h4>

<p>Lots&#8230; and I mean <strong>LOTS</strong> of stuff here.  Everything from the usual <a href="http://jquery.com/">jQuery</a> for easy DOM and Javascript manipulation and utility toolkits like <a href="http://underscorejs.org/">underscore.js</a> to nice templating and backend hookup systems like <a href="http://angularjs.org/">AngularJS</a> and <a href="http://backbonejs.org/">backbone.js</a>.  And of course, the now ubiquitous CSS bootstrapper <a href="http://twitter.github.com/bootstrap/">Bootstrap</a> for easy visual uniformity.</p>

<h4>Generators</h4>

<p>And to put it all together, there&#8217;s a boom in helping create and bootstrap your entire development stack.  Projects like <a href="http://yeoman.io/">Yeoman</a> and <a href="http://meteor.com/">Meteor</a> (my take is <a href="http://goo.gl/gcFEO">here</a>) give you the full client side stack ready and prepared, as well as some work being done to do the same for the server side.  Looks like a promising and interesting way to just get up and running fast without having to muck with all the setup work.  Plus, usually included are a testing infrastructure or two like <a href="http://vojtajina.github.com/testacular/">Testacular</a>, but there&#8217;s also things like <a href="http://visionmedia.github.com/mocha/">Mocha</a> and <a href="http://swarm.jquery.org/">Swarm</a>.</p>

<h4>So much help</h4>

<p>There&#8217;s a slew of <a href="http://egghead.io/">videos</a>, examples, documentations, forks, samples, convenient generators for just about anything.  If you don&#8217;t want to craft something on your own, just do a search for a generator of some sort and there&#8217;s probably going to be a site dedicated to it.  Video tutorials can show you how code is crafted, and sometimes what&#8217;s more interesting, see the IDE environment some of these coders use.</p>

<h4>And more&#8230;</h4>

<p>And all the even newer cutting edge <a href="http://semver.org/">0.0.1-alpha</a> projects in the works.  Bleeding edge concepts pushing boundaries and testing waters.</p>

<h4>Oh yeah, apps!</h4>

<p>Which is a whole different beast.  Written in ObjectiveC, Java, HTML5, with native support, ubiquitous support, responsive, catered and whatnot.  Various platforms like iOS and Android and their associated tutorials and development environments.  Don&#8217;t forget <a href="http://www.google.com/intl/en/chrome/devices/">ChromeOS</a> and its set of Chrome related apps, extensions and themes too.  The application stores themselves like Apple&#8217;s <a href="http://www.apple.com/itunes/">App Store</a> or <a href="http://play.google.com">Google Play</a> and the <a href="https://chrome.google.com/webstore/category/home">Chrome Web Store</a> all offer a variety of places to show your app to users.</p>

<h4>And so much more&#8230;</h4>

<p>There&#8217;s a lot&#8230; I mean, <strong>a lot</strong> out there.  And I&#8217;m finding more and more everyday, with every search, with every tangential link and every posting I run into.  Plus they&#8217;re all evolving and changing and improving.</p>

<p>I&#8217;ll probably be posting about some of my discoveries on a day to day basis via my <a href="http://goo.gl/j2cjL">Google+ account</a>, so feel free to follow me there.</p>

<p>I hope I can keep up&#8230;</p>

<h4>Further</h4>

<p>Sharing some additional links with more information that I found useful.  Feel free to recommend some more:</p>

<ul id="techexplorations"></ul>


<p>dynamically pulled from delicious. <a href="https://delicious.com/subdigit/%23techexplorations">see more&#8230;</a></p>

<script>
jQuery.getJSON('http://feeds.delicious.com/v2/json/subdigit/%23techexplorations?count=15&callback=?', function(data){
    var items = [];

    for(var i=0; i<data.length; i++){
        var bookmark = data[i];
        var element = $('<li>' + bookmark.n + ': <a href="' + bookmark.u + '">' + bookmark.d + '</a></li>');
        element.appendTo('#techexplorations');
    };
});
</script>


<p><span style="font-size: 0.50em; color: #aaa;">Image sourced from <a href="http://onceuponageek.com/2009/09/30/star-trek-enterprise-wallpapers/">onceuponageek</a> but unsure of the original creator.</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[yeoman and meteor]]></title>
    <link href="http://subdigit.com/blog/yeoman-and-meteor/"/>
    <updated>2013-01-15T16:00:00-08:00</updated>
    <id>http://subdigit.com/blog/yeoman-and-meteor</id>
    <content type="html"><![CDATA[<p>Really <em>really</em> quick impressions of <a href="http://yeoman.io">Yeoman</a> and <a href="http://meteor.com">Meteor</a>.  I was initially going to include <a href="http://angularjs.org/">AngularJS</a>, but I&#8217;ll leave that for a subsequent post since it&#8217;s a bit different.</p>

<p>So I&#8217;m exploring.  And deciding on a new project to start.  Which means I want to get versed in some new technologies out there just to get a feel for what&#8217;s going on.  I figured I should start with some of the more convenient framework generators, so here are some quick impressions of two I want to tinker with.  The impressions are in no way complete, nor have I even touched the surface of everything they can do.  So think of these as more my initial notes and part of the start of a process by which I&#8217;m hoping to pick a solid one and get going.</p>

<h3>Yeoman</h3>

<p><img class="left" src="https://lh3.googleusercontent.com/-7dfl8zt4rJI/UPWxMzMYEJI/AAAAAAAAEMU/p1MDs4ZA2_s/s300/yeoman.png" width="212" height="300" title="Yeoman" ></p>

<p><strong>Site:</strong> <a href="http://yeoman.io">http://yeoman.io</a></p>

<p>A pretty nice client side framework builder.  Run a simple command line and it&#8217;ll tell you what you&#8217;re missing, <strong>and</strong> how to install it (if you&#8217;re on Ubuntu, it gives you the apt-get commands, I&#8217;m assuming it&#8217;ll show you how for other systems as well).  Run it right out of the box or init it with things like <a href="http://angularjs.org/">AngularJS</a>, <a href="http://twitter.github.com/bootstrap/">Bootstrap</a>, <a href="http://backbonejs.org/">backbone</a>, <a href="http://underscorejs.org/">underscore</a>, <a href="http://jquery.com/">jQuery</a> or whatever your choosing (from <a href="http://twitter.github.com/bower/">Bower</a>).  It handles getting you setup, organized, laid out, and frameworked up with your choices so that you can just get going.  Bonus is that since it includes <a href="http://nodejs.org/">node.js</a>, you can quickly call up a server instance and see your code up and running live without having to muck with any additional server setup.</p>

<p>It feels <em>really</em> nice to have all the hard work done for you in terms of setup.  All the compression, parsing, transcoding, mixing, mashing&#8230; all done.  I think there are still some small issues with AngularJS integration and Bootstrap (it doesn&#8217;t show Bootstrap loaded on the welcome page), and I&#8217;m not sure if it&#8217;s possible to tell it to use specific versions (like if I wanted to use AngularJS 1.1.1 instead of the stable branch), but it does what it needs.  I&#8217;m definitely looking forward to trying it out a bit more and seeing if it gets rid of my setup headaches.</p>

<h3>Meteor</h3>

<p><img class="left" src="https://lh3.googleusercontent.com/-PTqZBFBlrQ8/UPWxMwsehCI/AAAAAAAAEMY/I2XF3337-Ds/s300/meteor.png" width="300" height="200" title="Meteor" ></p>

<p><strong>Site:</strong> <a href="http://meteor.com">http://meteor.com</a></p>

<p>Like Yeoman, Meteor is a framework builder.  But it also adds <a href="http://www.mongodb.org/">mongoDB</a> to the mix and gives you the complete stack.  So it setups up the client side <em>and</em> then also setups the server side.  The fun thing is, it links the two together so that you can easily access the server code and manipulate your data store right from the client console in your browser.  It also handles things like response latency, which is just a fancy way of saying it updates the local UI with data prior to sending it over the wire to the database for proper storage.  I&#8217;ll have to see how it handles cases of concurrent updates and how those are resolved when the local UI can be out of sync with the database information.</p>

<p>But that aside, it&#8217;s also a nice setup that helps to take care of the full stack setup.  As with Yeoman, it has customizable extension points to allow you to add your own favorites, even supporting AngularJS with a <a href="https://github.com/lvbreda/Meteor_angularjs">touch of extra work</a>.  This one I&#8217;m certainly keeping an eye out to see how useful it can be for just getting something quick and dirty up.</p>

<p>Oh, an even more superb benefit is that they give you a subdomain on meteor.com that you can publish to so that you can immediately host your project.  Right then and there.  That&#8217;s really cool if you want to do something dirt simple and quick but not necessarily something that needs to live permanently.  That, I think a lot more frameworks should offer.</p>

<h3>Thoughts</h3>

<p>I really love the direction these framework builders are taking.  They seem to remove the headache of having to get everything right and just allow you to start building.  But in the end they are still just frameworks, and you still need to build your content.  What I would like to see with the next evolution is to help support generic application flow layouts to come prebuilt.  I think this is something Meteor can benefit from immensely by offering to the developer a one command setup system to build a user based system application layout complete with login screen and twitter/facebook/google OAuth2 credential storage integration directly into the database.</p>

<p><strong>Update:</strong> <a href="http://docs.meteor.com/#packages">accounts-ui package on Meteor</a> seems to have this already.  Nice.  I&#8217;ll have to see if it does the trick.
<strong>Update:</strong> <a href="https://plus.google.com/115133653231679625609/posts/YDNbxVxi4er">yeoman-express-angularjs</a> Looks like <a href="http://expressjs.com/">express.js</a> support is in the works for an upcoming yeoman release.</p>

<p>That would really be awesome.  Having that taken care of, the developer can then really truly concentrate on just developing the meat of the application.  I&#8217;m not sure if Yeoman is slated to go in that direction as it deems itself a client setup system, but it can still be nice to see the right page layouts and hooks all setup and ready for you to go.  The less I have to think about how to do this and the more I can leverage the standard way to do it, the more time I&#8217;ll have to actually build my application and get things going.</p>

<p>Looking forward to seeing how these framework generators evolve.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[aaron swartz]]></title>
    <link href="http://subdigit.com/blog/aaron-swartz/"/>
    <updated>2013-01-14T12:00:00-08:00</updated>
    <id>http://subdigit.com/blog/aaron-swartz</id>
    <content type="html"><![CDATA[<p>I posted this initially <a href="http://goo.gl/cTw9O">on Google+</a>, but expanding on it a little here.</p>

<p><img class="left" src="http://farm2.staticflickr.com/1215/797631174_08783ceaed_m.jpg" width="240" height="160" title="Aaron Swartz" ></p>

<p>Sometimes the internet does do some good.  Today, in memory of <a href="http://www.theverge.com/2013/1/13/3872648/academics-share-links-to-copyrighted-journals-to-honor-aaron-swartz">Aaron Swartz&#8217;s death</a>, academics are taking time to freely &#8220;publish&#8221; their papers and make them available for the general public.  You can follow the #pdftribute tag on <a href="https://plus.google.com/s/%23pdftribute">Google+</a> and <a href="https://twitter.com/search?q=%23pdftribute">Twitter</a>.</p>

<p>It&#8217;s a good way to help spread information that is typically free to view and read, save for either restrictions due to copyright or distribution rights.  Things that were what Aaron circumvented and ended up being charge for.  More details are available on the corresponding <a href="http://en.wikipedia.org/wiki/Aaron_Swartz#JSTOR">Wikipedia page</a>.</p>

<p>I didn&#8217;t know much about Aaron, but the punishment just did not fit the crime.  Anyone could see that.  A million dollars and a 35 year jail sentence for the release of publications that were otherwise available to the [academic] public (just not as a mass archive).  Academic papers that, being academic, were supposed to be for the enlightenment and education of others, not to be tucked away behind publication paywalls and restricted repositories.  A punishment of this magnitude can certainly put a weight on anyone&#8217;s mind if they were being prosecuted for what was deemed an acceptable thing to do, albeit close to the line.</p>

<p><em>But this is not what bothers me the most.</em></p>

<p>It&#8217;s just unfortunate, that as usual, it took a life before this was realized.  And as great as this #pdftribute movement is, it really could have made a significant difference to have done this for Aaron while he was alive.  To be able to show active, not reactive support.  Obviously the movement shows that a supportive community exists, but only after the fact.</p>

<p>This isn&#8217;t a lesson to teach to the world about Aaron and the inequities of the justice system.  There will always be &#8220;Aaron&#8221;s and there will always be overzealous prosecutions.  Laws can be changed and attitudes turned, but something unfortunately always needs to trigger it to actually make it happen.</p>

<p><strong>No, this incident is a lesson for us.</strong></p>

<p>This is a lesson to teach to us that if we continue to ignore these things as just a problem that someone else has, we&#8217;re going to end up with more reactionary efforts rather than proactive ones.  We will continue to lose people that may make mistakes, but are in no way deserving of depression, punishment, or even death.  It&#8217;s a problem we all have: apathy, turning the eye, someone else&#8217;s problem.  Of course, I&#8217;m guilty of that to.  This post is completely reactionary after all.</p>

<p>But this is the exact mindset that needs to change.  To see an injustice and to be able to do something proactive, not reactive, about it.  Tributes are fine.  They&#8217;re a way to show support.  But they&#8217;re often <em>just too late</em>.  We need to be able to see what&#8217;s happening around us now and change what we can when we can to <em>spare</em> the need for a tribute.  It&#8217;s not an easy thing since people really are often driven by damage rather than motivation.  But that really needs to change.</p>

<p>This change in mindset, perhaps, is a much more fitting tribute for Aaron, and falls in line with what he was trying to accomplish.</p>

<p><span style="font-size: 0.50em; color: #aaa;">Image courtesy of <a href="http://www.flickr.com/photos/quinn/797631174/">Quinn Norton</a> via <a href="http://www.theverge.com/2013/1/13/3872648/academics-share-links-to-copyrighted-journals-to-honor-aaron-swartz">The Verge</a>.</span></p>
]]></content>
  </entry>
  
</feed>
