MikeScott8 Programming Thoughts

My musings, ponderings, and other posts on programming. And maybe gadgets and other nerd stuff.


Leave a comment

Recreating NWVDNUG site

This is the second post about the website for the user group I help run. You can go read the first post if you are interested in the attempt at manually upgrading the MVC website to the latest version of the MVC framework.

The article I referenced in the previous post said “The simplest way to upgrade is to create a new ASP.NET MVC 4 project and copy all the views, controllers, code, and content files from the existing MVC 3 project to the new project…” but then also listed steps to manually upgrade the site’s solution/project. Those steps didn’t quite match up with my situation and didn’t work, so now I am trying the “simplest way”. This is a reference of how simple this simple way is.

Steps I did to try this simple way will be listed below. There will probably be some ripping out of code as one of the updates needed for the site is to stop trying to host the meeting information on our servers and point visitors to the meetup.com page for signing up for the meeting and to see what the meeting topics are.

  • In Vs2015 did “File” “New Project…”
  • From the first dialog box that comes up I chose “ASP.NET Web Application” under “Installed\Templates\Visual C#\Web”
  • I entered the names for the project and the solution and clicked “Ok”
  • In the next dialog box I chose “MVC” from the ASP.NET 4.5.2 Templates section
  • I also checked the Web API references. I will probably not need them but added them in case I do keep some API endpoint on the site.
  • Set it to “No Authentication” as the site has no user login needed.
  • and then clicked “Ok” and let VS create the base solution.
  • next up was clearing out the views and controllers, and adding the ones from the old project.
  • then it was removing all references to the MeetingsService that the old site had to get the Meeting info from the database
  • Next was removing the DTO and domain entities references

I tried viewing the home page, and ran into some issues with the layout page and how it was doing the left navigation with passing HTML partial string to RenderSection. This was resolved by just moving the HTML from the partial into the main layout page. Now I could view the site. The various pages came up, it wasn’t pretty yet as I didn’t have any images for the site or the bootstrap referenced properly yet.

So after I got the images and bootstrap files added to the project, I tried publishing it to the web hosting provider. Unfortunately I ran into some small issues with this. I had to upgrade the server the hosting was on to latest IIS, and then the webdeploy tool didn’t have permissions to remove the previous files correctly so I had to manually delete all the files and then publish again and now the site is back up.

http://nwvdnug.org


1 Comment

Modernization of NWVDNUG site

Today is my first day of some downtime between clients. Hopefully it’s short one. So today I was doing some learning and trying to figure out what to study. One potential opportunity for me is with an existing client and “modernizing” a bunch of their internal applications.

I also had some updates that needed to be done on the website for the user group I run with Barry Stahl. I had just in the past month, to move to a new work computer when the old one’s lease was up. Due to this fact, the Windows Virtual Machine on the machine used for windows development I had only installed Visual Studio 2015 on.

I connected to Github from inside VS2015 and cloned the repo for the website for my user group. But when I went to open it I got several issues from the conversion report. The main issue that was not able to be automatically updated by VS is the fact that I had written the site in an older version of MVC framework.

Following the link from the conversion report took me to MSDN article that had a link to:

http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806

So I figured I’d take on this “modernization” of the user group site as a learning tool in case this comes up for future work I have to do.

Following the steps on the linked page I did the following:

  • Update the version numbers in the Web.config files (steps 1 and 2)
  • For step 3 I couldn’t do as it wouldn’t even load into Solution explorer. I am skipping it and will come back to it later, if needed.
  • Did step 4 to edit the csproj file.
  • Replaced the guid as listed in step 5
  • In step 6, I saved the file but couldn’t reload it in VS. So I closed VS and tried reopening (with fingers crossed). It still wouldn’t show in VS, so I closed VS again and continued with step 7 for now.
  • Manually added/updated the code listed in step 7

I was hoping these steps would work, but it didn’t seem to. I didn’t want to do what it said was the easiest way to do it, “The simplest way to upgrade is to create a new ASP.NET MVC 4 project and copy all the views, controllers, code, and content files from the existing MVC 3 project to the new project…” I didn’t want to do this as I wanted to keep the current repo, and all this changes to a whole new project and file structure would be a mess of a commit.

Watch for second post soon, covering how simple this “simplest way” is.


Leave a comment

Task.Status refresher and thanks to Jeremy Clark

Last month (Sept 2015) at the user group I help run (http://nwvdnug.org) we had the pleasure of Jeremy Clark come out and give a talk on Task, Await and Async programming.

I’ll Get Back to You: Task, Await, and Asynchronous Methods

There’s a lot of confusion about async/await, Task/TPL, and asynchronous and parallel programming in general. So let’s start with the basics and look at how we can consume asynchronous methods using Task and then see how the “await” operator can makes things easier for us. Along the way, we’ll look at continuations, cancellation, and exception handling.

One of the things he covered was something I saw a fellow programmer at work run into. The issue is when a Task completes you have a couple properties “IsFaulted”, “IsCompleted”, and “IsCanceled” and the fact that IsCompleted just means it is done running and this is set to true even if faulted. Therefore you cant use it to tell that the task ran to completion SUCCESSFULLY.

I remembered in the talk this came up and was discussed and way to handle it nicely was given. I could not recall exactly the way Jeremy showed that handled it and went searching for more on his site. I found the following post

http://jeremybytes.blogspot.com/2015/01/task-continuations-checking-isfaulted.html

And reading through that post I found the information I wanted.

Thanks again Jeremy! And if you are near anyplace he speaks (which is LOTS of places) I would go see him. He is a really good presenter and covers his topics in a well organized way and really gets the concepts across well.

Check his site and his upcoming speaking is right on his home page.


Leave a comment

Great tip for testing web apps

I often ran into the issue when testing and debugging web applications and sites that I would often have to clear cookies and caches in order to effectively work.

This tip posted by Scott Hanselman is a good one, I had not heard of, let alone thought of. In his post he talks about adding Chrome in incognito mode and Internet Explorer in private mode to Visual Studio. Both of these effectively means any cookies or cached data you create during that session would/should be removed when you close that browser. This should make it easier than having to manually clear that data when testing.


Leave a comment

Quick Unit Testing Thought

Just a quick thought I had the other week while driving to work.

I was driving to work and thinking about a unit test I had been in process of writing the previous night and what assertions I had to add to it. And just from that realized I had written my service that was being tested with multiple database calls that could be reduced to one, and then some local filtering in the service.

So just the THINKING of my unit tests, led me to some reduction in the service to database calls.

That’s all just a quick random development thought I wanted to pass on.


Leave a comment

Desert Code Camp Presentation Oct 2014 Slides and Code

Last weekend I presented a session at Desert Code Camp named “Using BreweryDb.com API with Xamarin Forms” I am redoing it tonight for my user group.

Here are the Slides for the presentation, not that there was much in the slide deck but it’s here in case someone wants it🙂

The code is posted to my GitHub :
https://github.com/mikescott8/DCC2014-02presentation/

The code at the end of the presentation is the second commit and that night I added the next step I was going to do but didnt have time to do and that’s the third commit. I hope to add the last item I wanted to do in the presentation with some Xamarin Forms Labs and Geolocation to the project and will add that to the repo as well when I do.


2 Comments

Building native cross platform apps using C# and Xamarin

So last week Xamarin developer evangelist James Montemagno was in Phoenix giving several presentations. Two of which I attended, the first one I went to was at the user group I started in the Northwest Phoenix Valley, NWVDNUG (Northwest Valley .Net User Group) when he gave an overview of Xamarin and it’s capabilities. Then a few days later, on Saturday I went to a workshop arranged by Joe Guadagno which he went deeper into the Xamarin tools, and walked through some of the newest functionality they recently introduced, Xamarin Forms.

I have been learning Xamarin development the past few months, and even submitted my first iOs app done using C# and Xamarin (which did get approved and is in the app store – it isn’t the best looking app as I am a programmer and not a designer). And within a few days (as I recall) of that submission Xamarin announced version 3 and Xamarin Forms. From the announcement it seemed that Xamarin Forms would have been very useful, as well as some of the newer design tools introduced in version 3, as I struggled with some of the Xcode tools trying to get the colors set for the app.

At that workshop, James walked all the attendees through our first Xamarin Forms app. I really liked the ease of use in creating cross platform USER INTERFACES (yes the UI) in C# code, or even using XAML to build the screens to be used across the various platforms. These screens use custom controls that are abstractions of native controls used on the various platforms. Read more about Xamarin Forms over at their site.

Well, originally I started this post to talk about my experience since that work shop, redoing my iOs app using Xamarin Forms, and at the same time creating my first Android app, and also replacing the old WP7/8 app I had created in the past. All these apps will have feature parity with each other and look similar but not exactly the same thanks to Xamarin. Each platform will use native controls and paradigms for the respective platforms while I write the User Interface just one time.

But since I got kind of long winded on this background post, I will hold off on the details of my journey on this trek for future posts. Well I might write one or two tonight, but schedule them to post in the future. Or I might go back to coding, as it’s such fun to so rapidly iterate over the screens and see them on various emulators.

Hope you come back to read future posts in this “series”

Follow

Get every new post delivered to your Inbox.

Join 2,849 other followers