AngularJS Directives 2

A few weeks ago I talked about a book, “Mastering AngularJS Directives”. A great book for directives but there aren’t that many that focus mainly on Angular Directives. I’ve recently been reading through a new book, AngularJS Directives. I have to admit that I like this book even more. One main thing it has that’s nice, is a better way to visually represent directive scopes which works well. Also, it goes into much detail on compile vs link. The other book does as well but in a different manner. It’s worth a look at.

AngularJs Select Element, set Label and Value

To set your select’s label and value expressions in AngularJs, you can simply do this example.

States and Countries

States have

Code: FL

Name: Florida

Countries have

Code: US

Name: United States

 

State:
<select data-ng-options="state.name for state in vm.stateProvinces track by state.code"></select>

Country:
<select data-ng-options="country.name for country in vm.countries track by country.code"></select>

AngularJs Directives

I haven’t posted much in regards to AngularJS since most of what I would say is already out there to read by someone else. AngularJs is a great technology for the web and if you like the use of includes and templates in your html, you’ll love it.

One thing I want to point out though is if you’re not using Angular Directives, then you’re not building your web app properly. Sure it might work, sure you can do things many different ways and not use directives at all but the biggest power in Angular is using Angular Directives.  The ability to create your own html elements which act as custom components.

The tricky part with angular directives is that they are easy to copy and paste from other sources to use and somewhat “easy” to create some really basic ones.  However, it takes time, skill and an understanding of the under lying core and events to really master directives and create your own proper directives that account for performance and calling things in the right order.

There’s a balance between KISS and DRY. On one hand you can get something working quickly with KISS. However if you do plan to repeat yourself elsewhere and want to keep your code DRY then it’s not so simple and a little more complex.

One great book I recommend and reading through twice is Josh Kurz’s Mastering AngularJS Directives.  Where other books just basically repeat what’s in the angular documentation with some better examples, this book goes beyond basic AngularJs and really gets into TDD and Angular Directives. Great book for anyone wanting to get to the next level.

Remember, have an Angular App with no directives at all? Then you need to go back to the drawing board.

Scrum for the Rest of Us

I had the pleasure to work with The Braintrust Group and review their book to provide feedback on it awhile back. It has now been published up on Amazon. I defiantly would recommend this book for anyone new or experienced with Scrum. It has a lot of interesting tips and real world problems/solutions as well as pitfalls to look out for. I have to promote since my names in the book :)

Scrum for the Rest of Us! by Brian M Rabon

jpeg

Product Details

  • Paperback: 92 pages
  • Publisher: Dog Ear Publishing (January 20, 2014)
  • Language: English
  • ISBN-10: 1457525801
  • ISBN-13: 978-1457525803

Are you... Trying to implement Scrum outside of software development? Looking for specific answers to your deepest Scrum questions? Wanting modern advice that will benefit your organization?
Scrum For The Rest Of US offers practical advice, questions and answers, and tips that will help you avoid costly mistakes with Scrum. Don't waste hours searching the web, reading references that are outdated, when you can have everything that you need in a single guide.
It's THE first book written specifically for anyone interested in Scrum outside of the software development industry. Regardless of what field you are in, this book specifically points out areas that may challenge you and your organization with adopting Scrum.
Perhaps you are new to Agile/Scrum, have heard a few buzzwords, but the core concepts are not familiar yet. Perhaps you are an Agile/Scrum veteran who wants to avoid roadblocks or improve implementation. Regardless of where you are on your path to mastery, this book is intended to help you maximize the benefits of Scrum.
What you'll find in this book:

  • When and why to use Scrum
  • In-depth coverage of the roles, meetings, and artifacts in Scrum
  • Clear answers to frequently asked questions
  • Common pitfalls and how to avoid them
  • Practical case studies and examples
  • Tips and tricks for maximizing success
  • Full glossary of terms and definitions
What you won't find in this book:
  • Technobabble and industry jargon
  • Software references
  • Boring charts and meaningless statistics

SQL 2012 – Remote Connection Changes

The release of SQL 2012 default to dynamic ports for remote access.

You need to open port 1434 for the SQL Browser if you want clients to access it remotely.

More info: http://jeffreypalermo.com/blog/how-to-configure-sql-server-2012-for-remote-network-connections/

excerpt:

This TechNet article explains that to connect, the client will send a UDP packet to port 1434 first to resolve the dynamic port.  Then it will connect as normal.

The appropriate Windows Firewall rule to establish is a program rule, not a port rule.

Understanding Visual Studio 2013 and Git Source Control

 

Previous TFS Mindset

If you are used to using TFS (Team Foundation Server), switching over to Git on Visual Studio 2013 is a different thought process.  We’re used to thinking with TFS, local files and then I “check-in” “check-out” back and forth on the server. The nice thing about this was that you knew your files were backed up on the server. The downside to this is that in a team environment you’re checking in code that might break the build and cause someone else to have problems when they get the latest for various reasons. You forgot to check in a class or your code wasn’t ready and there isn’t gated check in process. Either way this is the mental image when you think of VS2013 and TFS.

 

image

With Git, using your own Git Server or GitHub etc and trying to think of Git as you think of TFS starts to cause confusion around the new Team Source view for handling projects.

image I’ll attempt to simply the understanding and how it works.

 

End Result When using VS and Git. New Mindset.

Untimely this is the end result from “Adding” or “New” or “Cloning” a project. From Visual Studio you Check-In/Out from a local Git repository. This is great in that you can check in code without affecting others. You’ll need to backup your local files though. Then after you get to a point you deem worthy, you “Sync” the changes to the Git server.

 

image

 

Goal: Create a local Git Repo. There are three ways to start a new Git Repo.

Create a “New” Local GitRepo

image

You create a local project in Visual Studio 2013. You can then add it to a “New” git repo.

  1. image
  2. image
  3. You’ll now have a new .git folder in your Project Folder     SNAGHTML260c80e8
  4. Note: if this folder is in a Dropbox folder you’ll get an error “An error was raised by libgit2. Category = Os (Error). Failed to lockfile to ‘…‘:Access is denied”. SNAGHTMLb4407d4. Simple click on “Add” image  and put in the path to the new Git Repo location.
  5. You’ll now see your local repo in the Git Repo list.SNAGHTMLb4d2766

 

Or “Add” an Existing Local Git Repo

You already have a local Git Repo you want to use you then click on “Add” and find the existing local Git Repo. All previous Git Settings with this Repo are intact so when you Sync it will sync to wherever it synced before or prompted you to specify.

image

 

Or “Clone” an Online Git Repo to a new Local Git Repo

You want to pull down files from an existing online project you can then “Clone” the repo from the Git server to new local repository and then open the project in VS.

image

 

Now you can Sync to an online Git Server

Now double click one of the repos to open up that project.

Click on Unsynced Commits

image

Depending on if the project is New or has already been synced or is a new Cloned project you’ll see one of two screens.

This is the screen you’ll see if the project is newly created. Add in the URL to the online GitRepo you want to perform the initial push too and Publish.

image

This is the screen you’ll see if the project was an existing GitRepo Add or a Clone from an online Git Server. Clicking “Sync” will then sync your local files with the server files.

SNAGHTMLb5ec2f7

Structuring Your Application Project

Great article by John Papa on Angular App Structuring guidelines and it also applies to all applications using the LIFT Guidlines. 

Regarding all Application Projects, this is a good snippet of the article.

----

App Structure

I find it extremely helpful to have an idea of what is important to me and my team in structuring my app instead of focusing on the actual structure.

You have to find your own path that is comfortable for you and your team. Instead of just picking a structure, it’s helpful to think about the “why”, so I’ll walk you through the guidelines I follow and my thought process on why I choose how I do. This is a follow up to my post onAngular Structure.

How you organize your structure is up to you. There are many right ways of doing this, and consistency in your project is key.

These are my guidelines. I’m sharing them as one possible path you can take but the main point of this post is to share how I think about structuring my Angular apps. There is a reason for the madness and if you take anything from this post it’s to be sure to have a set of guidelines and conventions of your own.

Thanks to my friend Ward Bell for helping review these and in many cases, contributing to the content quality over the several projects with me.

The LIFT Guidelines

The structure should follow these 4 basic guidelines. When I find my structure is not feeling comfortable, I go back and revisit these LIFT guidelines

  1. Locating our code is easy
  2. Identify code at a glance
  3. Flat structure as long as we can
  4. Try to stay DRY (Don’t Repeat Yourself) or T-DRY

Another way to check your app structure is to ask yourself …

How quickly can you open and work in all of the related files for a feature?

I find placing related files for a feature in the same drawer really helps me be more efficient.

Locating

I find this to be super important for a project. If the team cannot find the files they need to work on quickly, that needs to change. I’ve been on projects where this has been an issue and it wastes time.

Locating code needs to be untuitive, simple and fast. You may not know the file name or where its related files are, so putting them in the most intuitive locations and near each other saves a ton of time.

Identify

When I look at a file I expect to know what it contains and represents. If this means you want longer file names, then so be it. For me its more about being descriptive with file names and keeping that contents of the file to exactly 1 thing. No files with multiple controllers, multiple services, or a mixture.

There are deviations of the 1 per file rule when I have a set of very small directives or filters that are all related to each other, they are still easily idnetifiable. If not, 1 per file.

Flat

Nobody wants to search 7 levels of folders to find a file. Think about menus on web sites … anything deeper than 2 should take serious consideration. In a folder structure there is no hard and fast number rule, but when a folder has 10 files, that may be time to create subfolders (or drawers as I like to call them).

The general guidelines here is base on your comfort level. I prefer a flatter structure until I see a specific value (to help the rest of LIFT) in creating a new folder.

T-DRY

Being DRY is important, but not crucial if it sacrifices the others in LIFT, which is why I call it T-DRY. I don’t want to type session-view.html for a view because, well, it’s obviously a view. If it is not obvious or by convention, then I name it.

I don’t name my controllers with “controller” in their file name nor their registered name with Angular. I differ from others on this point, but it feels so un-DRY for me. I may have 30 controllers and continually typing “controller” everywhere (in file names and in code) and its obvious that it is a controller felt completely un-DRY.

-----

There is a lot more there going on and in regards with AngularJS the source article is a great read.

Restrict IIS to listen only on X IP Address. Allowing you to co-run with TomCat/Apache on port 80 with IIS on port 80

 

Long title I know. So your running IIS on your server and serving up websites on port 80.  You also have some third party program that’s running on Tomcat. Maybe like Atlassian products like Jira or Confluence. However they have to run on ports like 8088 or 8443 for SSL because TomCat can bind the port numbers but cannot use port 80 because IIS hogs that up on all your IP addresses.

Assuming your server has more then one IP you can limit IIS to only bind on a single IP and then in TomCat’s config you can limit it’s binding IP to the other. (Technically you’re not limiting IIS you’re limiting the http web protocol that IIS uses).

 

Open a command prompt as an administrator

Show which IP Address IIS is listening/binding too with this command.

netsh http show iplisten

Then limit IIS to listen/bind certain IP address with this command

netsh http add iplisten xxx.xxx.x.x

Reboot the server (You could try restarting http service but that doesn’t always show up in services and it’s a pain. Easier to reboot).

Run the listen command again and you should that the restricted IP is no longer in the list. You’re now free to use that IP for TomCat or some other service and bind to port 80 and 443.

Quick Update and Hello

Wow almost a year since my last post I need to get back on the ball.  I’ve been quite busy since then.  I’ve moved on from leading that development team at Wolters Kluwer and now new projects and clients with my business partner Sean Lucey at LM Global Partners.

It’s been great as I focus on managing several new projects for our clients as well as still evangelizing the Scrum Framework for ALM.  It seems that many teams I speak with say they are “agile” but yet they don’t really follow a framework other then maybe a daily standup meeting.  I hope to get out more and speak on Scrum and using it in software development. I did complete my Scum Professional exam (CSP) awhile back and working towards another.

A lot of focus of my time has been more on the IBM WebSphere side then the Microsoft .NET development as before. Mobile is still there at the top of the list along with other projects such as iBeacon and custom development work.

Well there’s a short hello and update for now.  At Orlando’s Code Camp today. Great place to learn new things.