Month: January 2015

Lifehacks and my State of the Union address :-)

We live in constant tension between the urgent and the important. The problem is that the important task rarely must be done today or even this week.  … But the urgent tasks call for instant action—endless demands pressure every hour and day. … The momentary appeal of these tasks seems irresistible and important, and they devour our energy. But in the light of time’s perspective their deceptive prominence fades; with a sense of loss we recall the important task pushed aside.  We realize we’ve become slaves to the tyranny of the urgent. -Charles Hummel

So as some of you know I’ve been looking more into productivity tooling and lifehacks since shortly after I started this new job back in July 2014. Microsoft as a whole is such a vast company – and there’s such a torrent of information – that quite a few very bright people struggle to keep up. I also would like NOT to be up till ten at night, getting no exercise, and not really making a lot of progress on real work. You know the saying “Some things are urgent, and some things are important – but not everything that’s urgent is important, and not everything that’s important is urgent.” I saw a lot of that in previous work – I would dump my all into a career, or a company – and my family and personal health would suffer.

So I tried the following things:

  • Don’t check email in the morning. I set “email block” meetings in Outlook from 12-1, and 4-5 daily. In the other times, turn off Outlook.
  • Eat that frog. Plan 2-3 most important (not urgent) actions on calendar and get it done.
  • Reflection. End of day – what did I do today? What will I focus on tomorrow? What could be improved?
  • Time management. Pomodoro (50 minute working cycle / 20 minute break. P.s. sitting all day is TERRIBLE for your health, even if you work out)
  • Personal fitness. Paleo diet and Crossfit mostly. I flirted with vegetarianism briefly, and even went off coffee for a month (otherwise known as the WORST MONTH OF MY LIFE)

Here’s what worked:

  • Crossfit is terrific, and so is Paleo. Changing up my diet and focusing on working out and strength training – hard as it was – was a game changer for me. I’m stronger than I’ve ever been and am losing weight, at long last. I feel like a hero around my girls, which is worth quite a bit.
  • Doing a technology detox (see the pix below) was actually a good exercise. We went without TV for a month, and I uninstalled a lot of social media apps off my phone. Guess what? Life gets better after FaceBook.
  • Not checking email in the morning made a HUGE difference in making me less reactive. If you try only one thing from this post – DO THIS.

Here’s what didn’t work:

  • I didn’t really focus on keeping Important things foremost. Too many times the more important things slipped behind the urgent issues of the day.
  • Pomodoro was NOT GREAT for me. I am thinking of retrying it in the future, but since much of my calendar is meeting driven not heads-down programming – it just didn’t apply.

Here’s my goals for the future:

  • I’m convinced that buying out the time for myself and my family first – esp with health-related things like exercise and diet – is vital for me to be really productive. So I’m going to push ahead with this. Seven days successfully on an improved diet and the odds are you’ll stick with it – yet most people THINK they lack the self-control to make this change, and so they drop out on day 4 or 5. I have all kinds of events coming up and free lunches – so saying no to this is hard – but going alcohol-free and sticking to Paleo is really good for me in all areas of life.
  • I will add to my daily diary routine more of a reflection on life and the big picture.

 

One last picture again. This really sums it up.

Advertisements

ASP.NET 5 Is Going To Simplify Your Life and Increase Your Productivity. Honestly, truly.

I made a mistake recently and did my shortest posting ever – basically just a URL – talking about the newest features in ASP.NET 5. Time to explore this in a little more detail. I’m still wading through what I think about ASP.NET 5 from a programming standpoint, so give me time and patience. I also stole liberally a lot of the slide pix below from Channel9, which I’m crediting in the footnotes. Sorry I’m just not that good of a graphics artist guys!

ASP.NET 5 Design Goals

Remember this compilation process?

Here’s the design goals that I see with ASP.NET 5:

  1. Simpler –
    1. No more assembly refs, manage all in NuGet or edit project.json directly. (example, in project.json search Microsoft.AspNet..Http to show Intellisense) – can edit with text editor
    2. Unified programming model that combines MVC, Web API, and Web Pages
    3. Used to have things like System.Web.Http.Routing and System.Web.MVC.Routing. Combining them simplifies runtime significantly. Web Pages, WebAPI and MVC all MVC6. (note, web pages come later)
    4. Ability to self-host or host on IIS
    5. Side-by-side versioning of the .NET Framework
    6. New tools in Visual Studio 2015
  2. Smooth and Powerful
    1. New modular HTTP request pipeline. New pipeline is modular. Not a massive block – can pick and choose so it’s lean. Apps run noticeably faster.
    2. Cloud-ready environment configuration
    3. Ability to see changes without re-building the project using Roslyn compiler (viewbag.Message = “Changed code here”; in controller logic for About
  3. Open Source and Inclusive
  4. New flexible and cross-platform runtime (full, core, cross-platform)
    1. – full is std, Core is cloud-optimized runtime, cross-platform means future Linux/Mac. Right now you’d use Mono for mac .NET dev.
  5. Open source in GitHub
    1. Nothing hidden. Can watch code as it is written, submit extensions yourself. GitHub code repositories are used for all ASP.NET 5 development across the board.

Just for example, look at the duplication below with the three silos we used to have with three unevenly joined frameworks – WebForms, MVC, and WebAPI:

From Web Pages -> MVC -> WebAPI, lots of common elements. HTML Helpers in both Web Pages and MVC. Controllers, Actions, Filters, Model Bidning, DI from MVC to Web API. This meant LOTS and lots of redundancy. Attribute routing is a classic example – two separate implementations. One model now for model, binding, DI – all in common. And they really thought about DI first in this new model.

 

A New Way of Working as a Developer with Roslyn

One DI abstraction that the framework leverages. It’s minimalistic, by design. Pop in your own framework to handle IOC. And one note on authentication – tokens not yet migrated. Katana was our first stop, but OWIN very in your face. Now with vNext moving more to middleware handling of authentication. If you want the bits, the code is at www.asp.net/vnext, and nightly build is at github.com/aspnet/home.

The biggest change in my mind is the new config system – big focus is on moving seamlessly from on-premise to cloud. Big frustration in the past was, you’d configure locally it’d work great, move to cloud and it would blow up. This is an environment-based config system that understands what needs to be enabled based on key/value pairs. Note, all of NuGet packages are in the root, under packages folder. Look at the References node – there are all the dependencies. Browse thru it – ok, MVC depends on Razor, which …. Etc.

And you won’t see any system.web in this app at all! New config system is called out – so you can put name/value pairs for environmental variables (DEV, QA, PROD) iand the config system will pick up the value. Browse through startup.cs – see how it sets up EF, DI, ASP.Net Identity, and MVC. See the mvc routing set up at the bottom.

One of the biggest changes is – you don’t have to do a build, wait… no you modify controller code and hit F5. Try this – comment everything out. Then add an app.UseWelcomePage(); line at the end. Try it again with app.Run(async req => await req.Response.WriteAsync(“bfsfdldaf”));

So get in the habit of doing Edit, Save, F5. This to me was a huge improvement that I didn’t know I need it.

One change in naming conventions with MVC – you used to have to inherit from controller i.e. MyConttrolllerName : Controller. Now you can just declare a class. As long as it has the word Controller at the end, you’re good.

The package publishing is also smoother. Try to publish to a file folder locally. Should be fully self-contained. Could take this on a thumbdrive and pop onto a machine WITHOUT IIS. (Still recommend IIS)

I also dig the .NET compatability profiler. For my customers, this really will hit the mark:

 

Bower, Grunt and Gulp Integration

It’s now much easier to incorporate jQuery, Bootstrap, and Angular client-side packages, and use Build tools like LESS, JS Minification, JSLint, and javascript unit tests.

Curious about what these tools are? They all have to do with JavaScript.

  • Bower – manages client-side packages like Javascriopt/CSS libraries. http://bower.io/
  • Grunt, Gulp are JS-based task runners (which automates routine dev tasks like minification, compilation, unit testing, linting, etc). ASP.NET 5.0 uses Grunt. See this link – note the superior way of handling dependencies to previous versions of .NET. http://gruntjs.com/getting-started
  • Npm – is a packg manager. Bundled with all of the above.

For more on this, and a complete walkthrough, check out http://www.asp.net/vnext/overview/aspnet-vnext/grunt-and-bower-in-visual-studio-2015

MVC Ch-Ch-Ch-Changes

Some link candy for you first to set the stage.

Note some big changes above to deployments and EF migrations. Finally, Microsoft listened and is going Code-First versus the former unworkable and fragile EDMX design pane, where you would drag entities onto a window. This is MUCH more workable and extensible than EF5 shtuff. As a developer, I wouldn’t even mess with anything else. A few simple command line entries:

… and running these commands shows you the migration code you’d be using – for example the model snapshot and migration class. This sets up your entities (no more EDMX files!)

 

And ASP.NET MVC 6 now supports injection into a view from a class. See this link – http://www.asp.net/vnext/overview/aspnet-vnext/vc

And a little more on dependency injection – http://blogs.msdn.com/b/webdev/archive/2014/06/17/dependency-injection-in-asp-net-vnext.aspx

For a WebAPI walkthrough by the EXCELLENT Mike Wasson, see this link: http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6

Windows 10 – Microsoft Gets It Right

Maybe this is one of those blog titles that comes back to haunt me. Still, I can’t help but think – we’ve really come a long way forward, and I think Windows 10 is a winner.

Downloaded the bits last night from MSDN for Windows 10 Tech Preview, and set it up on my personal laptop. It abended about halfway thru the installation, and the rollback was seamless and click-free, requiring no intervention from me. I decided the issue was that my old laptop was still running the original Windows 8 (not 8.1) bits, downloaded and installed 8.1, and then ran the Windows 10 installation this time WITHOUT saving any apps or personal files. (Naturally I’d backed everything up first). Worked like a charm, and the whole process took maybe an hour. Then I downloaded Google Chrome, Drive, Microsoft Office, and a few other apps – my kids love Endless Reader – and literally, that was it. No trackpad issues like I had with 8.1, and everything seems to Just Work.

I’ve heard some snide comments from some of my fellow Softies – I’m sure there’s some frustration points (and the last release bits are about two months old). These will be fixed. The integration with Metro/Modern Apps is much smoother, and they’ve put it more in the background. I’m really enthusiastic about Windows 10 like I never really was about Windows 8 – I think they nailed the jarring UX and little irritants that made it one of my least favorite OS versions. It’s unobtrusive and works well on my older Lenovo Yoga. So far, I can say without reservation – terrific job guys. This may be one of the smoothest upgrade experiences I’ve ever had, and the UI may match the things I loved about Windows 7. I’ll keep this up to date, but so far – if you have a personal laptop that doesn’t have any mission-critical anything running on it – try out the release bits. I think you’ll like it.