Development
MattErickson (ME)
Jan 17, 2017
Categories: Development, HTML, JavaScript, and Angular
Tags:

Welcome back!

Ok, maybe I’m saying that to myself. In either case, long time no talk, internet! Today we have a quick trick to kill styling in angular-material, which is a framework for angular 1 or 2 that I have enjoyed link to angular-material. So, here’s the thing, we (at my work) have a large code base that already has a multi tenent implementation of different themes set and we didn’t implement that using material (wasn’t available 4 years ago). So when we started pulling in pieces and including javascript we started noticing things like a:not(.md-button) and .md-default-theme popping up around, to our surprise. Up until recently it hadn’t been a problem… well, you guessed it, it became a problem. We had a few buttons from our old bootstrap days with btn btn-link that should have been a specific color for a theme and they were being overridden. Took some digging but there was some dynamically generated CSS that was being shimmed into the <head> of the HTML. We found a way around this though, straight from the docs, check it out: Disable Theming. Note: this __JUST__ became a thing in version 1.1.1!!! Upgrade, for God’s sake!

Upgrade to angular 1.5 and input vs. model naming

Jul 27, 2016
Categories: Development
Tags:

So, here is the thing ng-model and name on input are two things you should be comfortable seeing if you are in the angular community. Well, let me tell you something… You will get some seriously weird behavior if those two items are the same. The form on scope will get weird validation state and your values will be all sorts of FUBAR. Keep these two magic strings seperate and don’t cross the streams.

Going to ngConf!

May 3, 2016
Categories: Business and Development
Tags:

Well, as I sit here at barrio in terminal 2 of the MSP airport I realize just how big of an opportunity I am bring being presented with. Being a full stack dev looking to separate myself from the crowd I found front end development interesting, opinionated, fun, and fulfilling more than other parts. I like to think I bring clarity and simplicity to both code and ui’s through my creations. With all the excitement in the world fueling my passion I could only go so far without supporting casts like my wife, my boss, his boss, her boss and ultimately the CEO of my work and the company as a whole. I want to take this trip to better me, as a developer, as a name, as a person, as a leader, and as a valuable employee. Much is to be learned and hopefully i can sponge it all. Wish me luck!

Apr 6, 2015
Categories: (ME), Development, and Javascript
Tags:

Sup?! Over the past few weeks/months I have been incredibly busy, as you can probably guess from my lack of attention to this site. That doesn’t, however, translate into getting nothing done. My

GitHub account tells a different story. As does my BitBucket account but that one is where I host all my private repos, sorry.

Angular

Angular I have immersed myself in the javascript culture, community and life. It has been eye-opening to the patterns, problems and struggles that are out there. Beyond just writing angular I have taken a shine to UX creation. The patterns and ideas behind UX fascinate me. It is a very soft… and hard science. It deals with how you feel about the page, how you interact with it, what this color, transition, spacing does to your person. But on the other end of the spectrum these ‘feelings’ don’t just get measured by your warm and fuzzies, they must be calculated to decide if what you are presenting is working. Depending on the platform that can be in orders placed, clicks into links, or time on a page.

Software?

Yes, software. Did you expect anything less vague? I have created software for less than 10 years now and my understanding has changed immensely. I still remember struggling with a shuffle algorithm for a blackjack game I wrote in college, now i would just do a `gem install cards`, kidding, but not entirely. Software in academia is very different then that of the real world. You don’t need to beat the horse to show that you know how to implement a stack, a queue, a list and all there related functions. Usually you don’t need to think about how your `O(n)` will turn out for this function or how performant your sql query will be. There is scoping around everything. If you have an admin page that takes 10 seconds to run a giant query for all payroll reports but the corner office wants that report all at once, you make it so.

Adventures in Angular

AiA I know I have mentioned it before but, man,

Adventures in Angular, nerdy or not, is really fun to listen to. I wish there were more. I listen to one on the way to work and one on the way home which usually ends up depleting my stash of things to listen to very quickly.

Dec 26, 2014
Categories: Business, Development, Javascript, Random, and Web
Tags: development, food.eat, ruby, and ruby on rails

I have been planning, plotting, schema…ing(?) about Food.Eat since my original post. I have made some progress but I have not nailed down exactly how I want to handle user authentication/authorization. Mostly, I think this is due to my choice in the loosely scripted PHP backend. With that knowledge tucked in the back corner of my head I made a desicion this morning based on some information from listening to one of my first podcasts Adventures in Angular I am going to not only learn but also use Ruby on Rails for my backend.

Ruby on Rails is a full stack web application framework that is relatively young by comparison to many languages in use today. It is fast, nearly pseudocode (spoken language-ish).

Similarly to using ruby as a new language on Food.Eat I also made the decision to go with angular 1.3.X for performance reasons and am also following John Papa’s Styleguide which, in my opinion, made my angular code much easier to read (Example).

If you would like to see any of the workings as I move forward, please, star, fork, help out, or just think “huh, Matt types things and I have no idea what they mean or he is talking about”.

GitHub Code Repository

P.S. Sneak peek

login1 login2

Dec 16, 2014
Categories: (ME), Business, Development, Javascript, and PHP
Tags:

Recently I decided I was going to look into a simple app that I wanted to build. The app for a first pass will be a simple angular/slim php backed app that will use a smartphone’s camera capabilities. The idea behind the application would be that as your day goes on you want to track all the things you eat. We all know the jig, get out the phone, boot an app, enter some arbitrary feeling information on your food you are about to eat. Well that is where I am going to attempt to differentiate, I want just a simple snap-shot picture. Take a picture and chow on! Heck, share it on instagram anyway, why not upload it to my server too? That’s it. The point of it is that each day you can see the amount and what you consumed. I believe the barrierless feel of it will make it easier to use than many “health” tracking apps.

From this point in the game I am architecting how my database is structured and planning out the implementation details. I am most likely going to host the code in a public repo on github because I feel this idea isn’t revolutionary, just unique. The easier I am able to make it the better off I will be in the long run. Of course, I will be withholding specific pieces of information like database passwords and adsense pieces.

Food.Eat GitHub Repo

Dec 10, 2014
Categories: Development, Javascript, and Web
Tags:

This morning I sat down at my computer to start work. Pull up our bug tracking system to see what is going on. Well, bug in the software, looks like something in angular. Pull up the page in the specified environment and hit f12. Woh, woh, woh, what is this ‘angular hint’ in my console?!?

Angular Batarang

Angular batarang is a google chrome plugin that helps working with and debugging angular tons easier, well, it didn’t really before but it does now! The plugin updated and now it seems to work pretty slick. You now have easier access to angular scopes and angular hinting via angular batarang.

angular_batarang

angular_batarang_scopes

Notes As of this post there are some stability issues going on with the plugin that is causing some failures but once those get ironed out I anticipate angular batarang to become quite useful in the coming months.

Dec 9, 2014
Categories: Development, Javascript, and Web
Tags:

Why must we do this So, due to some business limitations, and much to my chagrin, I am supporting IE8 at work. I don’t even want to talk about it. BUT with that we also want to not be “bossy” in the way we show users errors in our angular code. Brings me to the point; custom angular directive to polyfill the 1.2 -> 1.3 gap in modelOptions! (also not happy to change the core of angular in this way).

Angular Code time! Get the angular module (or create)

var module = app.module('myNeatDirectives');

Create the angular directive. We use ‘input’ because we don’t want opt in function here, we don’t even want opt out now (that can be added). We also restrict to ‘E’ which is element (i.e. <input type=”text” />). We require ngModel (<input type=”text” />) but throw the ‘?’ on there for optional inclusion. Finally setting the priority to 99 so it runs after the angular binding happens.

module.directive('input', ['$sniffer', function ($sniffer) {
    return {
        restrict: 'E',
        require: '?ngModel',
        priority: 99,

Next up, the bread and butter. We check if the input is of type radio or check box, no need to do special bindings there: return; Then we use angular’ built in $sniffer to check for event bindings, in a similar fashion to how modernizr would work, unbind any bound events from the element.

link: function (scope, elm, attr, ngModelCtrl) {
            if (attr.type === 'radio' || attr.type === 'checkbox') return;
            if ($sniffer.hasEvent('input')) {
                elm.unbind('input');
            }
            if ($sniffer.hasEvent('change')) {
                elm.unbind('change');
            }
            if ($sniffer.hasEvent('keydown')) {
                elm.unbind('keydown');
            }

Now we bind up our blur events and update the model.$viewValue on the blur callback.

elm.bind('blur', function () {
                if (ngModelCtrl.$viewValue === elm.val()) {
                    return;
                }
                scope.$apply(function () {
                    ngModelCtrl.$setViewValue(elm.val());
                });
            });

There are some cases (search boxes) that you may want a specific keypress to trigger events. I wanted enter to also set the value, so boom. Made it happen.

elm.bind("keydown keypress", function (event) {
                var charCode = event.which || event.keyCode;
                if (charCode === 13) { //enter key is 13
                    scope.$apply(function () {
                        ngModelCtrl.$setViewValue(elm.val());
                    });
                }
             });
//and close the rest of the curlies and squares
        }
    };
}]);

Nov 23, 2014
Categories: Development, Featured, PHP, and Web
Tags: google api, google calendar, google calendar api, google php api, and PHP

Google Api v1/v2 is dead, move on

Please note the Google PHP Api changes regularly and none of this code is future proof as the google api client is still in beta

Recently I undertook a php application that was using a ‘zend’ google calendar api. Well as of the 17th of November 2014 the google api v1/2 (used internally by zend) shut down. I used this as a learning opportunity to impl google api v3.

So here is the code that I have come up with that has worked pretty well for me. It is very similar to zend.

First we setup our google client from the client implementation on Google Api Php Client, you will need the client in your application somewhere and will need to require the AutoLoad.php in order to use it. (Not shown below)

Code it out

$user = 'useremail@gmail.com';
   
$gclient = new Google_Client();
$gclient->setApplicationName("My Apps Name");
$gclient->setClientId("**crazy_string_here**apps.googleusercontent.com");

if (isset($_SESSION[$user.'_service_token'])) {
	$gclient->setAccessToken($_SESSION[$user.'_service_token']);
}
$key = file_get_contents($privateKeyLocation);
$auth = new Google_Auth_AssertionCredentials(
	$config->google_email_address, //this is my service account email **crazy_string_here**@developer.gserviceaccount.com
	array('https://www.googleapis.com/auth/calendar'),//Google calendar permissions
	$key //contents of my .p12 file i downloaded from console.developers.google.com
);
$auth->sub = $user;//This is saying our service account will be acting as the sub user
$gclient->setAssertionCredentials($auth);
if ($gclient->getAuth()->isAccessTokenExpired()) {
	$gclient->getAuth()->refreshTokenWithAssertion($auth);
}
$_SESSION[$user.'_service_token'] = $gclient->getAccessToken();

At this point we have setup all of our google_client code so we can add our implemented “add calendar event”. First Instantiate the calendar service.

$cal_service = new Google_Service_Calendar($gclient);

Now we need to set up an event, give it a “summary”, location, and a start and end datetime in format

"YYY-MM-DDTHH:MM:SS.MMM+0001"

or

datetime->format('Y-m-d\TH:i:s.000P')
$event = new Google_Service_Calendar_Event();
	$event->setSummary("Event Title");
	$event->setLocation("123 Fake St. Dover, ME 41426");//Address City, State Zip
	$event->setDescription("You have a new event on your calendar!");
	$endTime = clone $aDateTimeObject;
	$endTime->add(new DateInterval('PT1H'));//1 hour calendar event
	
	$start = new Google_Service_Calendar_EventDateTime();
	$start->setDateTime($aDateTimeObject->format('Y-m-d\TH:i:s.000P'));
	$event->setStart($start);
					
	$end = new Google_Service_Calendar_EventDateTime();
	$end->setDateTime($endTime->format('Y-m-d\TH:i:s.000P'));
	$event->setEnd($end);
					
	$createdEvent = $cal_service->events->insert($user, $event);

At this point we have a calendar event returned to us and can use

$createdEvent->id

to get the event ID if we want to store it so it can be updated/deleted later in similar fashion like so:

$cal_service->events->delete($user, $createdEvent->id);

Hopefully this was enlightening for you and with all the recent changes (and shutdowns) of the google api this can help you transition your application more quickly to the new version.

Nov 21, 2014
Categories: Business, Development, Javascript, and Random
Tags: Angular, development, front-end, and javascript

Long time, no talk, internet! Recently, we have been extremely busy at work getting market ready launch of a new product ‘redeem.’ Leaving me very little time to write about anything (in a blog sense, plenty of coding). I have plenty to say and very limited time to say it in.

1) Google api v1/2 shut down on the 17th. I inherited a site dev for a nation wide in home computer repair company. It is a bit on the academic side of structure and code but it works. I have since converted much of it to PDO (php) and angular. Well there was also a framework living in the depths, Zend, which internally uses(d) Google api v2. See the tie back now? 48, grueling, hours later the site now uses Google api v3 in native php.

2) I have stepped into a role as a go to front end dev in angular, js and css/less. Which is more about teaching and less about coding, meaning I should NOT forgo “useless” Jasmine tests I did. Market ready, as I mentioned is this release. Code freeze is today. 20 units over our average and we made it. Now bug fun. Hopefully I will be able to take a breath of this harsh early winter Minnesota had served up.

Sorry for the lack of sweet code. I will follow-up shortly with a blur model update directive in angular when I get a minute, not on my phone, to write a party.

Almost forgot! I have listened to a podcast that I have enjoyed, adventures in angular, if you haven’t heard of it, check it out, good information to be had.

Until next time,

~(ME)

Aug 4, 2014
Categories: Business, Development, and Web
Tags:

After quite some time on the same theme I decided it was time to update. The old theme had some severe limitations in post style, ad additions, analytics, headers, footers. You name it, it was a problem. This theme is based of “Spacious” which i have, so far, found quite easy to work with. I haven’t found anything too out of the ordinary with it so far and everything seems to be working as expected.

I am using a twitter and a github widget on the front page as well as a custom theme widget for the front page layout. The rest of the blog is mostly as you would expect it to be, blogy.

Old Site Look

Sep 27, 2013
Categories: Business and Development
Tags:

The other day I was pinged by a professor from my college about a potential opportunity to give back to the community who has nurtured my technical growth. She introduced me to two individuals who are growing a newer program in minnesota: Technovation Challenge. This challenge is aimed at middle and high school females in an effort to give them opportunity to show off their technical savvy and a chance to learn a new skill. We will be using MIT’s App Inventor which is a drag an drop, block based programming language which lowers the barrier to entry for youth/adults in general. I am very excited about being a part of this program and helping Minnesota continue becoming a technology hub in the midwest.

More info can be learned IridescentLearning.org and on twitter @technovationMSP or @Code_Savvy and their main site Code Savvy.org

Apr 29, 2013
Categories: Design Pattern and Development
Tags: Design Pattern, MVC, and MVP

MVC vs MVP. MVC, as I said in a earlier post is Model View Controller. The controller is used primarily for the interactions from the model to the view/user. It (the controller) is responsible for getting the correct view out to the user.

Lets explore MVP a touch and then we will go into the differences. MVP, Model, View, Presenter. Model, just like MVC, is what holds the data, no manipulation occurs at this level. View, the user interface, but as Mike Potel from Taligent (IBM) says separates this view from the MVC view is that nearly all common day operating systems and software languages provide most of the controller functionality and the “controller” idea is now unnecessary for the most part. Lastly, the presenter, the data and view intermediary. The presenter is more like a stepping stone for the view and the model, it’s job is to serve the view with the model so it can bind to the data.

The main differences here are relatively clear; the view in MVP has business logic and will delegate to the presenter. It (the MVP view) also has data bindings to the model. The MVC design pattern uses the controller to server the views and does not allow direct access to the model for the view.

Summation: MVP seems to be a more natural method of how programming is going, even if people continue to use the MVC acronym when they mean MVP. In my opinion, after this research, I believe many people are just oblivious to this separation. I can see that in a more responsive design with a heavy ajax view that the MVP pattern would be much more useful than going clear cut MVC.

Thanks again for reading,

~(ME)

Happy Birthday Meyer

Apr 26, 2013
Categories: Business and Development
Tags: coders, ethics, programmers, and psychology

So, today, as most days, during compilation or time I take to rest my brain from strain I was reading through some of the G+ posts on development, technologies, and programming and came across this post. It is an excerpt from Jerry Weinberg’s book The Psychology of Computer Programming.

1) Understand and accept that you will make mistakes. The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry, so we can, and should, learn, laugh, and move on.

2) You are not your code. Remember that the entire point of a review is to find problems, and problems will be found. Don’t take it personally when one is uncovered.

3) No matter how much “karate” you know, someone else will always know more. Such an individual can teach you some new moves if you ask. Seek and accept input from others, especially when you think it’s not needed.

4) Don’t rewrite code without consultation. There’s a fine line between “fixing code” and “rewriting code.” Know the difference, and pursue stylistic changes within the framework of a code review, not as a lone enforcer.

5) Treat people who know less than you with respect, deference, and patience. Nontechnical people who deal with developers on a regular basis almost universally hold the opinion that we are prima donnas at best and crybabies at worst. Don’t reinforce this stereotype with anger and impatience.

6) The only constant in the world is change. Be open to it and accept it with a smile. Look at each change to your requirements, platform, or tool as a new challenge, not as some serious inconvenience to be fought.

7) The only true authority stems from knowledge, not from position. Knowledge engenders authority, and authority engenders respect – so if you want respect in an egoless environment, cultivate knowledge.

8) Fight for what you believe, but gracefully accept defeat. Understand that sometimes your ideas will be overruled. Even if you do turn out to be right, don’t take revenge or say, “I told you so” more than a few times at most, and don’t make your dearly departed idea a martyr or rallying cry.

9) Don’t be “the guy in the room.” Don’t be the guy coding in the dark office emerging only to buy cola. The guy in the room is out of touch, out of sight, and out of control and has no place in an open, collaborative environment.

10) Critique code instead of people – be kind to the coder, not to the code. As much as possible, make all of your comments positive and oriented to improving the code. Relate comments to local standards, program specs, increased performance, etc.

The most amazing part of all of this, in my opinion, is that this book was written in 1971. Remember that year? I don’t, wasn’t even alive yet, but do you know who does? Intel. Intel introduced the first microprocessor November 17th, 1971, the Intel 4004. Apple hadn’t released a computer yet.

Keep the commandments in mind in your work and I promise that you will be a better developer and be of more worth to everyone around you.

~(ME)

Apr 26, 2013
Categories: Development and Java
Tags:

MVC. Model, view, controller. The building blocks of a extensible, reusable, wonderful code base.

Model: The data. Does NOT depend on the controller. Not even a little! It doesn’t modify the data, it doesn’t do anything except hold the data in some way shape or form (E.G. hibernate or another ORM to take care of database interaction on the model side)

View: Is a bit trickier. The view in a strict MVC is the layer that the user interacts with. It can or can not depend on the controller but should always be independent from the model. In cases where the view depends on the controller the view often is combined with the controller, a lot of android applications will mesh these two layers slightly where the button clicks will get attached in the controller for the activities.

Controller: Depends on both model and view, unless of course the view is one in the same with the controller. The controller uses information from the model to send (or display) data to the user and interprets any user interactions that happen.

Moving into the point, that I know I have failed at in the past:

The model represents the data, and does nothing else. The model does NOT depend on the controller or the view. Example that is WRONG!!!!

static class MeController() extends BaseController {
  private static MeView s_view;
}
class Person() extends BaseModel {
  private String m_name;
  public void setName(String name) {
    m_name = name;
    MeController.m_view.refresh(); //THIS IS NOT OK!!!
  }
  public String getName() {
    return m_name;
  }
}

Proper MVC use of a model:

class MeController() extends BaseController {
  private MeView m_view;

  public void DoClickButton(int personIndex, String name) {
    m_view.get(personIndex).setName(name);
    m_view.refresh();
  }
}
class Person() extends BaseModel {
  private String m_name;
  public void setName(String name) {
    m_name = name;
  }
  public String getName() {
    return m_name;
  }
}

So, here, we see the main difference in this code: the model in the first example tells the controller to refresh the view. Now this model cannot be used by any other class unless every interaction with a person is meant to refresh that one list every time. Not only is the model not reusable for different classes but if we decide to give the user an option to have a grid or a list, which is becoming more and more common in web development and mobile, we cannot because we are attached to the list in the controller by hard coding.

So this takes care of re-usability of the model but what about the controller. This is all dependent on using a specific view. If we decide that this version of jQuery is not effective on mobile or what ever the case is we need to find all references to m_view.refresh(); and change it to (trivial but blocking) m_view.reload();. This is where separating the view and the controller comes in. If we open up the MeView and add this:

class MeController() extends BaseController {
  private MeView m_view;

  public void DoClickButton(Person person, String name) {
    m_view.changeNameButtonClick(person, name);
  }
}

class MeView() extends BaseListView {
  public changeNameButtonClick(Person person, String name) {
    person.setName(name);
    this.refresh();
  }
  private void refresh() {
    //do refresh for this specific view type
  }
}

class Person() extends BaseModel {
  private String m_name;
  public void setName(String name) {
    m_name = name;
  }
  public String getName() {
    return m_name;
  }
}

It may seem like it is slightly redundant to pass the person around the controller and view but with this setup we can swap in a new view that implements a new technology and don’t even have to bat an eye at how the controller will react. It will just work.

So for the finale, the answer to all of your Pastafarianism problems is MVC. If done correctly you can separate the model from your view and have three distinct layers that can be unit tested, compiled, and swapped in and out with different tech stacks without a huge head ache.

Hopefully this has clarified the struggle for many college CIS/CS majors.

~(ME)

Feb 8, 2013
Categories: Development
Tags: collaboration, oh god what have I gotten myself into, and tucker

Hello World!

Get it?

…It’s a programming joke…

…you know…like the first program you learn to write?

Sheesh, rough crowd.

As you may already have read in Matt’s most recent post, I’m the new guy around this site. My name is Tucker, I work in marketing/advertising as a jack-of-all-trades from copywriting to event planning. I’ve always been interested in technology and tinkering around but rather than learn cool computer stuff in college, I chose to take philosophy classes and play tennis.

Nice to meet you too.

So the background behind this collaboration is pretty straightforward, Matt and I have been buddies for a little while now and I am always pestering him with questions like: “I want to learn coding, how do I do it?” or, “What language should I learn?” or even, “Does this rash look contagious?” After a while he said, “Hey why don’t you post on my blog? That way you can document your learning, and I can help you as well as anyone else who reads it.” That’s our Matt, always looking to help others.

Well I said, “Hey that sounds keen!” Or something like that, and now you get to watch Matt and me transform the caterpillar that is my extremely limited and rudimentary coding knowledge into a beautiful coding butterfly. I hope watching me struggle through coding is informative or, at the very least, entertaining for you.

Have a safe weekend! (TC)

Feb 7, 2013
Categories: Development, PHP, and Web
Tags: PHP, Wordpress, and WP

First, I wanted to welcome a new contributor to the site, Tucker Combs! Tucker is, by profession, a marketing/advertiser. With that said I know that, from our days together in college, he has always had passion for technology and what developers love, creating. I want to welcome and thank him for joining in on helping us solve some of the struggles we go through learning technologies.

Now, on to the meat and potatoes of today’s post. Recently, the theme that I have based my site off (Living Journal) updated. While that wouldn’t have been a big deal because I incorrectly made my child theme by just copy-pasting the entire theme, I wanted the latest and greatest. So I attempted to update and move to a correctly made child theme. Needless to say I was left with the ‘White Screen of Death’ for a WP-Admin screen. After lots of reworking I was able to recover by starting from scratch with a local copy. However, I am dissatisfied with some things in this theme as a whole, one of which being the lack of ability to add a Google Author tag to the byline (the date posted by ‘name’ above these posts). So I looked through the function.php file to find out what exactly I am doing and how it does its thing. Well, here is what I found:

if ( ! function_exists( 'livingjournal_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function livingjournal_posted_on() {
	printf( __( '<span class="sep">Posted on </span>
<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>
<span class="byline"> <span class="sep"> by </span>
<span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span>
</span>', 'living-journal' ),
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() ),
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( __( 'View all posts by %s', 'living-journal' ), get_the_author() ) ),
		esc_html( get_the_author() )
	);
}
endif;

So there is a plus right away:

if ( ! function_exists( 'livingjournal_posted_on' ) ) : 

!! That means that because I now have a correctly made child theme my function.php file loads BEFORE the parent theme and I can overwrite the function! So I took it on myself to make it happen and here is how:

function livingjournal_posted_on() {
  printf( __( '<span class="sep">Posted on </span>
<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>
<span class="byline"> <span class="sep"> by </span>
<span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span>
<span> : <a class="url fn n" href="%8$s" title="%9$s" rel="me" target="_blank">Google+</a></span>
</span>', 'living-journal' ),
	  esc_url( get_permalink() ),
	  esc_attr( get_the_time() ),
	  esc_attr( get_the_date( 'c' ) ),
	  esc_html( get_the_date() ),
	  esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
	  esc_attr( sprintf( __( 'View all posts by %s', 'living-journal' ), get_the_author() ) ),
	  esc_html( get_the_author() ),
	  esc_url( get_the_author_meta( 'gplus_author_url' ) ),
    esc_attr( sprintf( __( 'Find %s on Google+', 'living-journal' ), get_the_author() ) )
  );
}

So that is nearly the same as the original minus a little tweak; the last two params and the Google+ link in the last span. To explain this we can expand on printf and php arrays a touch. printf is fairly straight forward in that it takes a list of objects, we will focus on just strings for now. So an example would be:

printf("%1$s %2$s", 'Knock Knock', 'Who\'s there?');

Piece by piece:

Note ” are not the same as ‘. Double quotes get used for evaluating params

%1$s

is asking for: **%1 param** **of type $** **string s**. The second would be self-explanatory from there.

'Knock Knock'

is the string literal, similar to ‘Who\’s there?’ but because we have a single quote within a single quote we must ‘escape’ it with a backslash. The only other explanation you may need is that I use a google plus authorship plugin to add a ‘gplus_author_url’ to the author meta data. As a last note most author data have two methods associated to them:

the_author_**object**

and

GET_the_author_**object**

. If you want to simply print the value to the page the_author_object works but you must use the getter if you’d like to use it inside the code. Thanks for reading and hopefully I helped, (ME)

Dec 26, 2012
Categories: Development, Git, and Linux
Tags: aliases and Git

So, it has been a while but I have been working hard so we all know that you can’t really blame me for that!

So today I want to run down my git configuration and how i make my life easier by using aliases… which if you haven’t guessed yet, I LOVE!

So here we go:

This is all in my ~/.gitconfig file

(Notes will be denoted by ‘##’ and are meant to explain the NEXT line)

[user]
  name = Matthew Erickson
  email = matt@matterickson.me
[color]
  branch = auto
  diff = auto
  interactive = auto
  status = auto
[alias]
  ##Shows all aliases
  aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
  ## Pretty log (don't forget a -n XX to only show XX amount of commits)
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset 
%s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
  ## Formats a patch without using whitespace
  format-patch = format-patch -w
  ## Same as above but for term diffs
  diff = diff -w
  ## Quick status
  st = status
  ## Quick rebase
  rb = rebase
  ## Creates a new branch tracking the current one
  bk = checkout --track -b
  ## Quick branch
  br = branch
  ## Quick Checkout
  ck = checkout
  ## Quick pull w/rebase
  puller = pull --rebase
  ##is supposed to push for the branch refs
  pushup = "!f() { git push -u ${1:-origin} HEAD:`git config branch.
$(git name-rev --name-only HEAD).merge | sed -e 's@refs/heads/@refs/for/@'`; }; f"
  ##fetch and rebase on master
  up = !git fetch origin && git rebase origin/master
  ## Shows the top contributers and how many commits they have w/o merges
  who = shortlog -n -s --no-merges
  ## Cleans up git configs (should not be done while in a working state)
  cleanup = !git remote prune origin && git gc && git clean -dfx && git stash clear
  ## Shows new info from last command (usually after a git pull or git puller)
  new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
  ## Shows branch tracking information
  track = "!f() { ([ $# -eq 2 ] && ( echo \"Setting tracking for branch \" $1 \" -> \" $2;
git branch --set-upstream $1 $2; ) || ( git for-each-ref --format=\"local: %(refname:short) 
<--sync--> 
remote: %(upstream:short)\" refs/heads && echo --Remotes && git remote -v)); }; f"

Nov 18, 2012
Categories: Development, Featured, HTML5/CSS3, and Web
Tags: galaga, game, and html5

This project is also available on

GitHub:Mutmatt/Pew-Pew

Special thanks go out to:

Weapon Upgrades: SeongJae Park

Sound Effect: Haebin Yoon

Recover The Original Motion: JongYoon Lim

Boss Stage: Lee WonJae

Nov 10, 2012
Categories: Development, HTML5/CSS3, and Web
Tags: game, html5, and pong

Unsupported Browser
Click to start…

Player 1 (Left Paddle): W for up, S for down Player 2 (Right Paddle): Up arrow and Down arrow

This project is also available on

GitHub:Mutmatt/pong_html5

Oct 10, 2012
Categories: Business and Development
Tags:

As many of us do as software developers/engineers/hackers I have been to, answered and asked my share of questions on stackoverflow in my career. They also now have an invite careers section of their site. I joined recently and have since completed my profile to a point where they see fit to grant me some invites.

Not really much else to say but: Accept Careers 2.0 invite =)

Oct 10, 2012
Categories: Development
Tags:

Wednesday September 12th. I had 2 meetings this day, one was with the tech lead of the project to make sure I knew what I was going to be doing and a broad spectrum overview of the goal for the next release, the second was with the PM (project manager) to explain the timeline with myself and the other engineer and lay out our project dev plan.

The plan that was laid out for us gave us ~4 weeks until release. I thought well that should be a pretty good time line based on what I’ve done so far. Well Thursday came and something happened to me similar to my college experiences (on occasion) I had supernova focus. Much to the surprise of the PM and my coworker on the project with me, I finished not only the API but also the full service and parser that is not going to test for 4 more weeks! O.o

BOOM!!!

Oct 10, 2012
Categories: Development
Tags:

September 11th

Let me start off this post by telling you a short story of my family and the date. Today is September 11th, 2012. Eleven years ago today, the United States had a terrible event occur by extremists from a religious group. I could go into my thoughts on this but no one actually wants to hear that, and that is not why you are here so onto the story.

I have three sisters, the middle, in age, of the three had a child when she was sixteen years old. When the child was born my uncle and his wife decided to adopt her. Fast forward a few years, my uncle was working as a radio show host in the south tower of the world trade center and his wife worked as a video editor (I believe). Well on the night of September 10th, 2001 Taylor, the little girl whom they adopted, came down with a stomach bug and was not able to go to daycare. This meant one of her parents wasn’t able to go to work, my uncle drew the short straw and stayed home. Later that morning the tower that he would have been working in fell. . .

These are the problems that we should care about and these are the problems that matter. Not the one I will do a short bit of complaining about here:

Actual Post about Software Project Moves

On September 1st I left on my vacation back to Minnesota for my fathers wedding. I left work and knew my supervisor was going to be in charge of any bugs or issues that arose from my work that I had been doing over the last few weeks. I received a few emails with questions and comments while I was out of the office but nothing that a sentence or two couldn’t explain. Well, this morning I came into the office with a cup of coffee in my hand and a smile on my face ready to get back to work to be met with some news that, as of this point in the day I am still unsure of the polarity, good or bad. I have been reassigned to a different project and will be changing supervisors.

I look forward to the new challenges that await me on this new project and wish my past team good luck (although I will most likely still pester them as I always have).

Oct 10, 2012
Categories: Development and Java
Tags: business rules, drools, java, and jboss

So, today, again, I was working with jboss’ drools engine writing some more rules. My rule went something like this:

rule "Do stuff"
  when
    $obj : Class(name == "")
  then
    $obj.somethingElse.setValue("More Stuff")//I did more stuff
end

So according to the docs this should work fine….. well mine is broken. And non the less the //I did more stuff is what broke it. For reference, I am using Drools 5.1.0.M1, which, I know, is NOT the docs that I am pointing you to but I would assume that commenting should be the same!

DroolsDocs#Single_Line_Comment

Oct 10, 2012
Categories: Development
Tags: eclipse, hacking, hot-key, quick, and typing

Note: This information is meant to be generic to Eclipse as a whole but for reference I run ubuntu 10 and eclipse Helios Service Release 2

Eclipse In the company I work for we use

Eclipse as our primary IDE for development. Eclipse is a project by “The Eclipse Foundation”. It is an IDE that has MANY, many plug-ins that range from official ones such as the JBoss plugin to make using jboss technologies like drools rules easier to work with to from within eclipse to AnyEdit which is something I use to remove trailing spaces and tabs from my code (for checkstyle purposes)

Hot-Keys By using Eclipse efficiently you can decrease the amount of time you spend on tedious things and increase your productivity significantly Firstly, moving quickly without letting your hands leave the keyboard can speed you up more than you would expect. So lets look at some of those hot-keys, most of which are built into OS’.

Ctrl+c :copy
Ctrl+v :paste
Ctrl+x :cut
Ctrl+z :undo
Ctrl+y :redo
Ctrl+(arrow key [left or right]) 
will move the corresponding direction one word, if you are using programming standard camel-case variables this will move you one word and stop at the beginning or end of the word you are moving over.
Shift+(arrow key [left or right]) 
will move the corresponding direction one space and highlight the space you moved over.
Ctrl+Shift+(arrow key [left or right]) 
will work as you might expect, moving one word the corresponding direction AND highlight the word.
Ctrl+Shift+r 
will open an ‘Open Resource’ window that allows you to quickly search your workspace. Inside of this search you can use ‘*’ to get a wildcard for any string forward or backward or ‘?’ for any char. Example: applicationContext-ws-stuff.xml could be found by searching app*con*ws-stuff* or even shorter as app*con*stuff* may give you a short list. Again if you are using camel-case you can use just the FIRST-LETTER of the word. Example: java file: TeacherToStudent.java could be found by typing TTS.

Ctrl+Shift+t
will open an ‘Open by Type’ window that works essentially the same as the Open Resource window
Ctrl+Shift+m and Ctrl+Shift+o 
these two hot-keys are nearly the same, +m will add any existing imports that are missing and +o will add any missing ones and then organize them based on how you have your code-style defined
Alt+Shift+r 
a powerful key combo. This is the variable or method refactor tool in hot-key form!
Ctrl+o 
another very useful hot-key this will open a small search window for the class you are currently in, you can search for variables or methods quickly and reach them even faster!
Shift+(home or end) 
this will highlight the space from your cursor (where ever it may be) to the end or beginning of the LINE you are on.
Ctrl+i 
will correct the indentation of the file, if you have a line or section of code highlighted it will respect this highlighting and only correct indentation of THAT section or line of code!
Ctrl+d 
will delete the line you are on, again if you have a section of code or space highlighted ALL of it will be deleted
An honorable mention, although not a hot-key, is the
'Replace with Local History' and 'Compare with Local History'
menu items. There have been many times when I changed a significant amount of code only to come back the next day to realize that everything is broken and I have no idea what the method/class I changed was supposed to do. Well this is where your butt will be saved. Right Click the class you changed->Compare/Replace With->Local History will bring up a new menu that will show you past changes (saying it has the history still stored). This has saved my butt in the past and I’m sure it will again in the future. I know a lot of these seem like they may be useless and trivial clicks but once you get used to using them you will be able to move so quickly through your files and eclipse that you will never fall out of ‘programming mode’ having to copy, paste things around a file.