I hate Microsoft… (this is such an annoying phrase)

Hello everyone.  I want to write an article that discusses an issue that drives me insane.  Recently I heard a developer claim “I hate Microsoft…” and proceeded on a tirade of this reason or that reason why they are frustrated.  In the world of technology, Microsoft has been around long enough that we should realize they aren’t going anywhere any time soon.  Whenever I hear a tech person proclaim that they hate Microsoft, in my ears, it sounds like a mechanic saying: “I hate metric tools.”  It is a pointless thing to hate.  When I hear that someone is frustrated with Microsoft, what it usually comes down to, is that they are not aware of what the right setting is they are looking for.  The product is doing exactly what it is supposed to, and the developer just doesn’t know what setting to change.  In the past several years, since Satya took over, Microsoft has taken a 180-degree turn and started building some fantastic tools.  They say it is hard for a rudder to turn a large ship, but Satya has done it.  In fact, Microsoft seems to have the attitude that I would want to see out of any tech company: “Check out what we have, but if you don’t like it, we’ll support you using what you want.”  The next time you hear someone proclaim they don’t like Microsoft, just remind them that it doesn’t make sense to not like your tool, you just need to learn how to use your tool.

I just want to clarify, I am not paid by Microsoft, nor am I saying that they are the best tool for everything.  However, they are a prevalent force in the tech industry and that means if you want to be good at Tech, you need to know how to use Microsoft products.

Azure.Mobile.Server.EntityData ModelState is invalid… why?

So, I have been building an ASP.NET MVC 5 web application making use of the Azure.Mobile.Server SDK.  So I created my model objects, and everything is excellent.  I used the scaffolding to generate my Controllers and Views.  From there I spent some time customizing my views, which I hate to do.  I’m not a very good front-end developer, and I have all the respect in the world for those who are skilled at making things look pretty.  So I went to test the various CRUD operations and starting at Create, I failed.  I set a breakpoint and found out that my model state was invalid.  The default code does something like this:

When I was clicking the submit button on my form, the check of ModelState.IsValid was coming back false.  This is because in my form, I was only adding data to “ModelProperty.”  The rest of the bindings (Id, Version, CreatedAt, UpdatedAt, Deleted) are all part of the Microsoft.Azure.Mobile.Server.EntityData object type which I inherited in my model.  I use this data type because I have an accompanying mobile app and the Mobile SDK does a great job of offline syncing my data.  So… I had to remove those bindings from the [Bind(Include = “…”)] statement.  Once I removed those, my ModelState was valid, and life continued.

The next tech bust

The internet is a wonderful source of information.  Videos and volumes of text exist to provide information for just about any imaginable topic.  In 1990 the World Wide Web was born.  In the past 28 years, we have managed to fill hard drives with data from almost all recorded parts of human history.  Why did people put forth the effort to compile all of this information?  It started as an academic endeavor, but it quickly became a method of making money.  Fast forward to present day, and everyone with a computer and a blog can start making money.  How is it so easy to start making money?  It is because money is being earned on false pretense.

Continue reading → The next tech bust

Finding the last date a date stamped item shows up in a table (SQL)

So, I was writing a query to retrieve data from a Dynamics GP table.  There was a question about when certain codes were last used.  So, my thought process took me down the path of saying I could write a query that pulls all of the distinct codes from the table like so:

However, there is also a date column for when the code is used.  This is because it is a transaction table.  So, if I add in the date stamp, I will get tons of rows returned as a result of the query.  I needed some way to only get the last date stamp that each code was used.  For that I used the following code:

So how does this work?  According to the Microsoft Docs:

You can use the OVER clause with functions to compute aggregated values such as moving averages, cumulative aggregates, running totals, or a top N per group results.

I guess this is a good time as ever to say that I am using SQL Server, and this applied to SQL Server 2008 and beyond.  So, this essentially makes a group of each code, and then uses the aggregate function MAX to find the maximum date used per group of code.  Now I can say when the last time a specific code was used.

Greatest Common Denominator/Divisor/Factor (Geek Style – Euclidean Algorithm)

I recall learning about performing fractional math when I was young.  To be completely honest, I never actually learned an efficient way of determining greatest common denominator.  I brute forced it most of the time, meaning I just kept trying numbers until it seemed like I got the right denominator.  My method was very similar to what you see here at Kahn Academy.  As part of an algorithms course, I needed to write a function to determine the Greatest Common Denominator.  Any time you start talking about writing code

Any time you start talking about writing code, and you consider performing a function that “brute forces” an answer, your code will not run very fast.  Sometimes, you have no choice but to brute force a solution.  Sometimes there is a better way.  In this case, brute force is not the best way.  Here is how a brute force method would look:

Continue reading → Greatest Common Denominator/Divisor/Factor (Geek Style – Euclidean Algorithm)

Shuffle a list C# (Fisher-Yates shuffle)

So, recently I was writing some code, and I was presented with a problem.  I had a List<CustomObject> in C#.  I needed to jumble that list up and still use those items.  Keeping in mind that I am not one of these prodigies that went to MIT, and I do not memorize algorithms for fun, I set about like most good programmers to Stack Overflow.  I came across this post which provided me this code: Continue reading → Shuffle a list C# (Fisher-Yates shuffle)

Offline Visual Studio 2017 Install

It is very easy to forget that many people have development environments that do not have internet access.  In this day and age, it’s easy to install frameworks and IDE’s from the web.  Recently I wanted to start using Visual Studio 2017 for a project.  My environment is completely isolated from the internet, and getting access is not feasible.  So how was I going to get Visual Studio 2017 from the internet to a computer with no internet access?  In the past this was easy, just download an iso and either burn it to a disc or just copy and mount the iso.  With Visual Studio 2017 Professional edition’s total download size is 27.1 GB. Continue reading → Offline Visual Studio 2017 Install