Friday, September 8, 2017

Govern CMS EDMX Diagram

I'm making good progress on my new Government Content Management System (Govern CMS).

Probably have another 1-2 weeks of development before I have a minimum viable product.

Here is my Entity Framework EDMX for that System:

Thursday, September 7, 2017

HTML Helpers - ASP.NET MVC's equivalent of JSTL Custom Taglibs

I have found the equivalent of Java's JSTL Custom Taglibs: HTML Helpers.

I started moving logic out of my Razor Views and into HTML Helper classes.

Here's my first, and it's a beauty (uses recursion to build out nested lists):

    public static class CategoryExtensions
        public static IHtmlString CategoryDisplay(this HtmlHelper helper, IEnumerable categories, int indentSize)
            string indentString = "";
            for (int i = 0; i < indentSize; i++)
                indentString += " ";
            StringBuilder stringBuilder = new StringBuilder();
\n"); stringBuilder.Append(BuildList(categories, indentString)); stringBuilder.Append(indentString).Append("
"); return new HtmlString(stringBuilder.ToString()); } private static IHtmlString BuildList(IEnumerable categories, string indentString) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(indentString).Append("
    \n"); foreach (Category category in categories) { stringBuilder.Append(indentString).Append("
  1. \n"); stringBuilder.Append(indentString).Append("
    \n"); stringBuilder.Append(indentString).Append(" " + category.CategoryName + "\n"); stringBuilder.Append(indentString).Append("
    \n"); if (category.SubCategories.Any()) { indentString += " "; stringBuilder.Append(BuildList(category.SubCategories, indentString)); } stringBuilder.Append(indentString).Append("
  2. \n"); } stringBuilder.Append(indentString).Append("
\n"); return new HtmlString(stringBuilder.ToString()); } }
I'm glad to get the logic out of the Razor views (which should not have such complex logic) and into proper C# classes.

Friday, September 1, 2017

Angular 4 node_modules

Wow ... I'm planning on building my Angular 4 App this weekend.  I am working through the tutorial and just had a moment of horror ...

217 MB for a JavaScript Framework?!  You've got to be kidding me.  

There are over 700 subdirectories under node_modules. 

Now, I did take a look at the HTML generated and it does not appear to reference node_modules.  I am going to see if I can get away with NOT deploying it.

Thursday, August 31, 2017

Angular 4

I'm starting on Angular 4. Going through the Tour of Heroes Tutorial.

I've done plenty of Angular 1.x in industry and feel comfortable with it.

Angular 4 looks like a completely different beast altogether.

Some initial thoughts:

  • Coming from a C#/Java background, I like TypeScript
  • However, I do not like the concept of transpiling. I think it's asking for trouble, and I have no doubt at some point I will end up troubleshooting/debugging ugly transpiled JavaScript.  
  • I really think that the JavaScript V8 Engine and other JavaScript Engines should run bytecode.  Both JavaScript and TypeScript should be compiled 1st class languages, similar to how Java and Groovy are both compiled to ByteCode, as C# and F# are both compiled to MSIL.
  • I've found my IDE: Visual Studio Code. This thing is beautiful and responds very quickly and feels light and easy to use.  It's even better than WebStorm and Visual Studio .NET.  I do hate having 2 IDEs (Visual Studio Code, Visual Studio .NET) for front-end/back-end though. 

Sunday, August 27, 2017

Govern CMS

To-date, I've filled out 45 RFPs.

One common trend I've noticed is a need for Content Management System (CMS) Software.

Other than Website Redesign (which cannot be generalized), CMS comes in 2nd for "Most Requested Software".

So, I figured I would build a CMS System.  I have an informal CMS backing Municipal Agenda, so I figured i'd take the time to extract and formalize it into a standalone product.

To get there ...

First, the Data Model.  Everything starts with the Data Model.

More to come.

I've thought about using this as my opportunity to learn F#. 

The problem I will encounter is that this is not a common language, and if customers want to look under the hood, it will be a mark against me.  Nope, going with the tried and true C#. 

Saturday, August 26, 2017

WCAG 2.0 Color Contrast Ratios

Today I learned about WCAG 2.0 Color Contrast Ratio Requirements.

WCAG 2.0 requires that the foreground and background colors have a 4.5:1 contrast ratio at Level AA and a 7:1 contrast ratio at Level AAA.

Now, I don't know what a 7:1 contrast ratio looks like, but my gut feel is it's like black on white or white on black.

So, I'm targeting WCAG 2.0 AA Compliance for all my sites.  That's sort of the gold standard, anyway. 

My WCAG-compliant labels: 😊

.label-default {
    color: #FFF;
    background-color: #777;
.label-danger {
    color: #FFF;
    background-color: #a30909;
.label-warning {
    color: #FFF;
    background-color: #a36c06;
.label-success {
    color: #FFF;
    background-color: #124400;
.label-info {
    color: #FFF;
    background-color: #027091;
.label-primary {
    color: #FFF;
    background-color: #003FBB;

Friday, August 25, 2017

Twitter Bootstrap 4

I've migrated my Recruiter Review Site to Twitter Bootstrap 4 so that I could use a more modern Bootstrap Theme: Real BS 4.

To say that it's been painful would be generous.

Most of my pain has been caused by Twitter's decision to remove Glyphicons from Bootstrap 4.

I would love to know why anyone thought that this was a good idea.

It broke my Bootstrap Star Rating widget, and it's been a LONG road back this evening, after I downloaded the source code for the widget and took it apart, turned it upside-down before figuring out the cause.

For anyone who needs to re-introduce Glyphicons to Bootstrap 4, follow this Stackoverflow Post.