MVC Adventures Part 2

First off, one more thing I hate about Linux: when you need to copy some web files and all of your USB drives are somehow being mounted read-only, and you can’t format the USB you used to install the OS in the first place. It’s running dd right now, but even on a “tiny” 16GB drive, it’s taking forever.

Anyway, more MVC adventures. I’m really happy that the book I am reading, “Pro ASP.NET Core MVC”, actually dives into what all of the various extra folders mean in an MVC project. I haven’t covered everything yet, but I can skip NuGet altogether and just edit the project.json file manually. I actually figured out that a weird error I had occasionally seen was due to a mismatch in the versions of some of the dependencies. Sweet!

It’s a bit of slog right now. I’m frustrated I’m not learning MVC faster, but the combination of mild busyness and major laziness has produced a mediocre study ethic. I remember one of my past supervisors advising me to schedule my time not with some rigid pass/fail criteria but with a “here is my goal” criteria. So my goal is to put in 30 minutes every day. I don’t hit every day, but I have learned a lot more lately because of this. Tonight I decided to bite into the design of this new website I’m building because I used to love doing that. I would fight html and css for hours on end, and it’s why they are so second nature to me today. I need to be doing this with C# if I really want to get good at it.

Anyway, I set up bootstrap using Bower. It’s not hard by any means, but you haven’t done it until you’ve done it. Currently battling bootstrap trying to figure out why my easy sample is not working. I always want to read without writing any code, but that never works well. I hauled ass on that Lottery WPF application I built, learned a ton.

For what it’s worth, I bought “C Programming: A Modern Approach”. I’m worried I’m going to spread myself thin, but it’s my personal conviction that I can’t say I’m too serious about my profession until I know some C. I wouldn’t dare apply to that others, but I am curious to learn and am rather hard on myself. At the same time I need to know my current tools, I also need to expand my understanding of computers. It took me far too long to realize that logging into a database is basically interacting with an OS process/daemon, and I’m sad I don’t know exactly how those work.


MVC Adventures Part 1

I had just started to learn Asp Core MVC last fall, but my new job uses Python and PL/SQL so I haven’t touched MVC since. However, the time has come to start building the middle-tier for my friends in Nepal, so I’m diving back in.

I have to keep this short because it is definitely bedtime. I started a blank MVC project in Visual Studio and *gasp* forgot to check that little checkbox that pulls in the default MVC assemblies. So of course all my references in the Controller were off. Sane people would just scrap the project and start over, but I lack this desirable quality and decided to tough it out. That’s really the only way to learn, especially in systems like Visual Studio where you have training wheels Frankenstein’ed all up in your business. Point-n-click for WebForms just killed me, I just died inside, I had to blank-slate my way through every asp tag attribute before I felt I wasn’t a complete idiot with what I was doing. Anyway, after several headaches, I finally figured out that if I browse the offline packages in NuGet (what an idiotic name…), I could get Microsoft.AspNetCore.MVC installed, my references would resolve, and I could start the page with the debugger. Of course, I’m still missing tons of packages, and don’t know how to specifically get the Tools assembly from Microsoft.AspNetCore.Razor (I’m referencing another project that shows which packages are normally created when you check the checkbox), but hey, it doesn’t die.

And you want to know something fun? Currently, my page is not loading. But that doesn’t stop MVC from loading a page with nothing other than “Hello World!” in text on it. Somewhere deep in that system it is defaulting to that. Which is retarded because that defeats the entire purpose of doing “Hello World”. “Gee, you screwed up, so we’re going to tell it Hello World for you!” But if you couldn’t get it to work, that is failure, that is not “Hello, World!”

Ok, despite my frustrations, THAT IS HOW IT IS DONE!!! You can’t ever hope to really understand Visual Studio until you can bootstrap the defaults yourself. Ye-ah! Anyway, there will be a part 2.

Visual Studio Woes


I put my old Powerball Simulator up on GitHub today, and started to continue working on the newer version that uses WPF. I decided to rename the namespace I was working in as I wanted to tame all of the elements in the solution, and came face-to-face with my greatest frustration with Visual Studio: the absolute ubiquity of configuration and code behind files, which nest and hide references everywhere.

See, I come from a Python background. As long as the program is in your path, all you have to do is insert an import statement to pull in other libraries, type your program, then you type “python” on the command line and BOOM, you have a working program. C#? You have debug directories, assembly directories (because apparently the system doesn’t know where to find System.Core etc.), and God forbid you write a simple program that doesn’t have a “code behind” to match every other file in your program. It took me a good half hour just to figure out what was causing my program to die because that old namespace was referenced in five places I never manually typed it out.

I do appreciate how much Visual Studio automates, especially with XAML presentations, but I wish I understood why all of the things in place are there. Long ago, I opted to learn ASP.NET by manually typing the aspx file and discovering what worked, what did not work, what was required in the declaration, and what I could safely exclude which VS  otherwise automatically supplies. That was great. It will take time and experience to really figure out whether I even need all of this messy configuration for other programs.

Rant over.

// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>