Rusty Divine

Live, Love, Learn, Teach

Subtle MVC, Razor, Membership Bug

I encountered a really frustrating bug yesterday when I tried to hit my MVC project on the QA server, and it turns out it manifested itself in several telltale ways:

  1. The QA server (IIS 7) reported 403 Forbidden for my login page.  Could not load anything.
  2. My local machine (IIS 7 Express) would not show the ValidationSummary on the login page
  3. My local machine would not let me navigate to the forgot password page, or any [Allow Anonymous] pages other than the login page, unless I logged in;
  4. after logging into my local machine, and then everything worked fine, and I could get to the [Allow Anonymous] pages
  5. My local machine would not show the company name text in the banner until I logged in

The last sign was finally what clicked – I didn’t realize these all were related until I noticed that one.  On my _layout.cshtml page, I have the following:

@{ Html.RenderAction("_CompanyName", "CompanyName"); }

The site is a multi-tenant application that has a url like: {company}.domain.com.  The above calls into an action that takes that {company} and looks up the company name in the repository, then displays that name in the banner.

The problem was the _CompanyName action on the CompanyNameController was not marked as [Allow Anonymous].  IIS Express was able to let this slide, but IIS did not!

#HDC12–Building a Dream Team

This afternoon I attended the Build a Dream Team hands-on lab presented by Chris Carlson and Gabe Romero of Aureus Group.  They presented tips on how to hire and retain great team members.  We’re currently looking for some top talent at Five Nines, so the timing was great.

I learned that we could improve our interview process by creating a performance profile that focuses on what the candidate will have to do to succeed in the job.  What will be the objectives?  What projects will they work on?  What responsibilities will they be assigned? How long will they have to reach each objective?  Defining the future of what they are going to need to do and making sure they are qualified to do that is more important than arbitrarily specifying that they need XYZ certification or a degree in ABC.

For the first hour we talked about hiring and the book “Hire With Your Head” by Lou Adler.  Chris was a big fan of this guy’s work, which I haven’t read before, but a lot of the tenants she talked about from his work rang true for me, too.  For example, when writing an ad for a job, focus on what the candidate will have to do, not what experience they have to already have.  Make the candidate a customer – try to sell them on your company, and make sure they leave with a positive experience even if they don’t get an interview.  Try to limit bias and emotions by asking the same narrow, quantitative type questions to each candidate, and then scoring them on some pre-defined categories (having the book would help here, it comes with templates and extras).  Also, be careful of initial reactions to a candidate – it may be best to take a 30min break before you talk to anyone about the evaluation of the candidate.  Concentrate on a candidate’s past performance – what have they done to improve the environment at past jobs?  If nothing, then don’t expect them to hit the high notes in the future, either. 

When checking references, validate the candidate’s strengths with specific examples.   Would that reference hire them or work with them again?  How does the candidate compare to others they know at the same level?

The next hour or two we talked about accountability and engagement.  Gabe described the difference between responsibility and accountability by explaining that responsibilities are assigned, or given to you, but only you can be accountable to get the results done.  He talked about how engaging with your team is critically important to help understand what they are experiencing, what are their frustrations and aspirations and goals, and to give feed back and reinforcement.

I think our AppDev group is doing a very good job of accountability and engagement.  We practice an agile approach to all of our work, and each of us is held accountable each day at our daily stand-up meeting where we quickly review what we said we were going to get done yesterday, what got done, and what we’re doing today.  You can see instantly that someone got off track, and no one wastes more than half a day going down a rabbit hole before they get a chance to come up for some air and help from the team.  Our iterations are time-boxed, so it is obvious at the end of the 2-weeks whether we got done what we had planned or not.  After each iteration, we do a retrospective (Good/Could be better/Improvements) that has proven to be such a powerful agent of change that I’ve been thinking about how to apply it to my personal life.

We have weekly one-on-one meetings with our Director where we talk about whatever is going on with us in the environment.  It’s a great chance to vent (constructively, of course) and get some feedback.  We build trust as a team because we know our opinions matter and we really are being listened to. 

We occasionally have strategy meetings where we talk about the course of our group and what direction we will concentrate on in the future.  Each of us brings our ideas to the table during those meetings, and all thoughts are welcome.

#HDC12–Building Win8 Apps with JavaScript

I’d like to thank HDC12, Jeff Brand and Matt Milner for a great hands-on lab today on building Win8 apps with JavaScript.  We worked through a demo project that queried Twitter for tweets based on a search string, then presented the results in a nice grid.  Each cell in the grid had the author’s picture and the tweet.

Jeff made the demo project available via Git: https://github.com/spartyspartan/TweetScan

Resources on Win8: http://goo.gl/Wu4NH

Here are a few things you need to know about developing a win8 RT app on the JS stack (some of these would apply to a xaml app on WinRT, too):

  1. You can't reference js from a CDN or internet; has to be local.  The app has to be able to run disconnected, and has to be run in one security context
  2. In un-snapped view, the app layout needs to scroll horizontally, not vertically
  3. The app is suspended when it is not visible.  After a while, if resources get low, Win8 will terminate your app and not tell you! So, on receiving the suspend event, assume you are/will be terminated because there is no event for terminated and go ahead and save state or whatever you need to do.
  4. You have to have win8 & vs12 to develop the apps – they use WinJs which relies on WinRT
  5. The app has to support snap view – when the app gets snapped to the side.  At that point, it needs to either scroll vertically or handle the change gracefully.  For instance, a game might just put up a “paused” screen in that case.
  6. The most common architecture will probably be a single-page-app.  You can use js namespaces to avoid script collissions.
  7. Make sure to check the project’s manifest in the package settings to set the capabilities and available declarations so that the app can access more than just the Internet.
  8. Blend visual designer is definitely worth checking out.  It renders the app in an engine that includes a javascript sandbox.
  9. You can hook into the Search/Share/Settings charms to set up how your app will interact with these
  10. You can add custom buttons to the app bar – be sure to check the metro design guidelines for where to put global vs context-sensitive tools.
  11. The app store reviews all apps.  If you are selling yours, there is a tiered pricing structure starting at $1.99.  MS takes 30% of sales up to $25k, and 20% after.  If you don’t sell the app, it can be added to the store for free and MS provides advertising tools (or you can use others), and you can still use a payment gateway in the app without having to pay MS.  So, the only time you pay MS is if the app is for sale.  There are very easy ways to make it a trial software for 7/14/30 days (e.g.) and MS will handle users trying to trick the trial by uninstall/reinstall or other means.
  12. When an app is off-screen, it gets 0 CPU.  A device can have up to 7 apps that are running background processes (think email, IM), and the user will choose which of their apps win if there are >7, so don’t assume your background polling process will be running if your app is suspended.  You can also do live tiles for the start screen that use push notifications or toast notifications, and this is a free service that MS provides.  For some rare cases, like a skype app, there are ways to keep a connection open even if the device is locked.
  13. You can have multiple tiles for one app – think a separate tile for each stock you are tracking in the financial app.