Sunday, August 24, 2014

No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file.



Upgrading to EntityFramework6 has been a nightmare. There has been almost no useful documentation for how to get everything up and running with MySql. I downloaded the connectors, the MySql plugin for Visual Studio, and Entity Framework 6.1.1. Still, I kept receiving this error:

"No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file."

The problem here was that I had two different projects in my solution file. One was the source code, one was tests. The test project was not importing the same dependencies for MySql.Data that the source code had. The solution I did was the following:


  1. Right click on the Solution (top level in the solution explorer)
  2. Manage Nuget packages for solution
  3. Go to Installed tab
  4. For all of the EntityFramework related packages (MySql.Data, MySql.Data.Entities, MySql.ConnectorNET.Entity and MySql.ConnectorNET.Data), select them then select the "Manage" button.
  5. Enable each package for all projects.

Tuesday, August 19, 2014

EDMX Fix - An exception of type 'System.ArgumentException' occurred while attempting to update the database."



If you are connected to a MySQL database and you're trying to re-populate an edmx file from the database tables and you receive this error, it means that you are missing the following plugin:

http://dev.mysql.com/downloads/windows/visualstudio/

You should already have the MySQL Connector plugin for VS2013 if you reach this point. That's all you need to get connected and get updated.


Wednesday, June 18, 2014

Bill Gate's Bookshelf

I find the best way to improve yourself is to find role models. People who have done what you want to do, whose footsteps you can follow in. Not to discredit those who go their own way, as it can be just as rewarding, but to highlight the works of savants.

http://www.gatesnotes.com/books


Monday, June 9, 2014

ng-options 50 states $scope variable

$scope.states = ["AL","AK","AZ","AR","CA","CO","CT",
          "DE","DC","FL","GA","HI","ID","IL",
          "IN","IA","KS","KY","LA","ME","MD","MA",
          "MI","MN","MS","MO","MT","NE","NV",
          "NH","NJ","NM","NY","NC","ND",
          "OH","OK","OR","PA","PR","RI","SC",
          "SD","TN","TX", "UT","VT","VA","WA",
          "WV","WI", "WY"];

Monday, June 2, 2014

Google Authenticator lost phone workaround

This won't do much good if you have already lost your phone, but if you still have it and want to take extra precautions for the potential loss of your phone, check out the backup codes that Google offers. These will allow you to gain access to your account even after your phone has been lost.

Friday, May 30, 2014

How to do null-safe Integer comparison in Java

result = ObjectUtils.compare(firstComparable, secondComparable)
commons-lang3 has a useful null-safe compare method between two Comparables. This comes in-handy for non-primitives like Integer, Long, Boolean, etc.

Thursday, May 29, 2014

How to comma delimit list of strings in Java

Tuesday, March 25, 2014

10 Most Controversial Programming Opinions

What's your most controversial programming opinion?


  1. Programmers who don't code in their spare time for fun will never become as good as those that do.
  2. The only "best practice" you should be using all the time is "Use Your Brain".
  3. Most comments in code are in fact a pernicious form of code duplication.
  4. XML is highly overrated.
  5. Not all programmers are created equal.
  6. If you only know one language, no matter how well you know it, you're not a great programmer.
  7. Performance does matter.
  8. Print statements are a valid way to debug code.
  9. Your job is to put yourself out of work.
  10. Getters and Setters are Highly Overused.

Tuesday, March 11, 2014

Getting the most out of Fitnesse Suites

Fitnesse offers the ability to use scripts inside tests and suites as well as use REST calls following their API. This is handy because it gives us the chance to write JavaScript hacks to improve the utility of Fitnesse.

One of the fundamental problems I have with Fitnesse is maintaining the state of tests. Often times, requirements change, and tests need updating. It's easy for Fitnesse tests to get left behind when you need to meet deliverables and updating your tests requires a great deal of effort. Luckily, the Fitnesse API has some features we can take advantage of to get a glimpse at the last execution of tests.

When writing a suite, I will create tables to put similar tests together. I start with the test name, then a description, and the current status. The script uses the test name to query the restful service, which returns the latest test result and populates the status cell based on the result.

Benefits

  • Allows to skip running the suite, which can be time consuming on the machine it is running (as well as blocking for other test suites)
  • Get immediate results for each test instead of waiting for the suite
  • Easier to navigate than the suite test page

Setbacks


  • Slows loading of the suite page because ajax calls have to be made.
  • Script is very simple that this doesn't provide much useful info, just a broad overview.

Example




To use this script in your suite, you need to make a few changes:

1. Update the ajax url parameter with your url, leading up to the suite with the following period. As long as the testnames in the first table column are valid, it will automatically populate the current status column with the last data.

JavaScript

<!--[if lt IE 7 ]> <span id="ie" class="ie6"></span> <![endif]-->
<!--[if IE 7 ]>    <span id="ie" class="ie7"></span> <![endif]-->
<!--[if IE 8 ]>    <span id="ie" class="ie8"></span> <![endif]-->
<!--[if IE 9 ]>    <span id="ie" class="ie9"></span> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <span id="ie" class=""></span> <!--<![endif]-->
<script>
"use strict";
// These values count up each of the tests statuses. Display for a summary of the suite.
var passingTests = 0;
var failedTests = 0;
var exceptionTests = 0;
var ignoredTests = 0;

$( document ).ready(function() {
// For each tr that is not the first
$('table tr:not(:first-child) td:first-child').each(function() {
// get the name of the test out (from >Test Name)
var testname = $(this).text().substring(1);

// Make the rest call
$.ajax({ url: "http://yoururl.yourSuite."+testname+"?pageHistory&resultDate=latest&format=xml", cache: false, type: "GET", dataType: "xml", context: this, success: function(data) { var output = ""; //IE doesn't support innerHTML element if($("#ie").is('.ie6, .ie7, .ie8, .ie9')){ var correct = $(data).find("counts")[0].firstChild.text; var wrong = $(data).find("counts")[0].firstChild.nextSibling.text; var ignored = $(data).find("counts")[0].firstChild.nextSibling.nextSibling.text; var exception = $(data).find("counts")[0].firstChild.nextSibling.nextSibling.nextSibling.text; } else { // For everyone else - Note, you'll have to update the 
// childNodes unless you follow the same table setup I use.
var correct = $(data).find("counts")[0].childNodes[1].innerHTML; 
var wrong = $(data).find("counts")[0].childNodes[3].innerHTML;
var ignored = $(data).find("counts")[0].childNodes[5].innerHTML;
var exception = $(data).find("counts")[0].childNodes[7].innerHTML;
}

// Count all the values
output += "<span class=\"correct\">right: " + correct + "</span><br/>"; if(wrong != "0") { output += "<span class=\"wrong\">wrong: " + wrong + "</span><br/>"; $(this).closest("tr").addClass("testFailed"); } if(wrong != "0" && exception == "0"){ failedTests++; } if(ignored != "0"){ output += "<span class=\"ignored\">ignored: " + ignored + "</span><br/>"; ignoredTests++; } if(exception != "0"){ output += "<span class=\"exception\">exception: "+ exception +"</span>"; $(this).closest("tr").addClass("testException"); exceptionTests++; } if(wrong == "0" && exception == "0" && correct != "0") { passingTests++; $(this).closest("tr").addClass("testPassed"); } // Append to status td $(this).closest("td").next().next().append(output); } }); }); }); </script>

CSS

<style>
.testPassed {
background-color:#CDFECD;
}

.testFailed {
background-color:#FFCCCC;
}

.testException {
background-color:#FFFFCC;
}

.correct { 
color:green;
font-weight:bold;
}

.wrong { 
color:red;
font-weight:bold;
}

.exception { 
color:#FFCC00;
font-weight:bold;
}

.ignored { 
color:grey;
font-weight:bold;
}
</style>

2016 Update: I wrote this when I was a beginner in Javascript. The code is very hacky, because the table html is generated by Fitnesse, making it hard to grab them via jQuery. This script could be improved upon by:

  • Adding last date of test run to each test, so the user has an idea of how stale the test run is.
  • Not using this, and instead just using Jenkins to run Fitnesse suites and see results in Jenkins.
  • Adding expandables on each test row to see exception text or errors.

Monday, March 3, 2014

How to renew your blogger domain name

  1.  Go to admin.google.com, Sign in using your Google Apps credentials, username@yourdomain.com (not your gmail account!) -- I think the usernames default to "bloggeradmin@yourdomain.com"
  2. If you still can't get in, go to  https://admin.google.com/yourdomainname.com/ForgotAdminAccountInfo
  3. Once you submit a password reset, check your gmail linked to the account for the password reset.
  4. Log in using new credentials, go to Billing section
  5. Activate automatic renewal for domain registration.
I followed these steps and had this expired domain back up and running in about 15 minutes!