Plugin by Social Author Bio

Using Visual Studio 2012 Web Publish For Staging On The Internet

 

Let’s say you have a production code like http://siliconvalley-codecamp.com and you want to have a test site on the internet that will not be seen by anyone unless they login (or maybe even login as an admin).  Using web.config (with Visual Studio 2012), transformations makes that very straight forward.  I know because I just did that.  I created a test site (say: http://test.siliconvalley-codecamp.com) and set up my publish to replace my normal anonymous authentication (allowing anonymous users) to one that denies anonymous users.  Just as an aside, the reason I did this was I notice that google was indexing some of those pages even though my robots.txt file says to deny access to all robots.  Apparently some crawlers don’t respect that signal.

For a little background, I did publish some basics about doing transforms here:

http://peterkellner.net/2013/03/31/vs2012-web-deploy-using-tranforms-for-connection-string-in-production/

So, here is what I have in my web.config file that is part of my normal project source control.

image

And, here is my transform file (Web.Test.config)

image

And, just to show the result, this is what end up on my test server:

image

And Finally, just for some extra bonus stuff here at the end, here is what my tranformation looks like that simply removes the debug option when I publish to production.

image

Using IntelliTrace With Entity Framework In Visual Studio 2012

This is not a big deal, but I have recently bumped into several people that did not know about it so I thought I’d do a blog post just to show what it is and how is just trivial to use for useful stuff.

The issue I’m showing is how to see the Sql generated from Entity Framework.  My old habit use to be to stop the debugger and hover over the query variable in the code, grab it as a debug variable, then cut and paste to SqlServer enterprise.

Now, I just go to the DEBUG menu in VS, Windows / Intellitrace and I get a nice listing on the right side of all my ADO.NET calls.  The last one is the one I just did. 

My code below is pretty self explanatory.  You can see I’ve just issued a db.SaveChanges().  You can also see the Sql generated for the update.  I was checking because I wanted to confirm it was just updating one column.  It was!

image

Hope this helps!

Last Nights Meetup At Sencha HQ In RWC Excellent!

Last nights meetup at Sencha Headquarters in Redwood City with Jacky Nguyen presenting was excellent, and as usual very fun.  Jacky talked about tons of performance stuff related to the holy grail of 60 frames per second rendering and mobile sweetness. Sadly, I learned that my ping-pong skills are in total decay. Having slide a very far way from Dorm 5 champion at college, it feels like I’ve returned to rank beginner.  Very sad.

http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/events/114540882/

Most of the usual suspects were there.

Why ReSharper Is Worth Using (reason #879)

 

I often email the folks at JetBrains (the makers of ReSharper) letting them know that one of their refactors is wrong.  They often email me back letting me know my about my misunderstanding.  I actually enjoy this.

Today, was a perfect example but I did not get past the ReSharper feedback form when I realized my code was wrong (sadly missed the exchange with them).  I’m busy writing the SEO save for Silicon Valley Code Camp’s new web site (coming by next week hopefully).  In this case, I’m looking for a trackId passed into the sessions.aspx page. If I find it, then I redirect to a more friendly URL.

Here is my code I was going to complain to ReSharper about as incorrectly warning me that my trackId = –1; is redundant.

image

SNAGHTML40a7f61

My mistake is that trackId is always replaced (even with 0) if the QueryString does not evaluate to a valid int.

The corrected code is this:

image

One less bug thanks to ReSharper.

Follow

Get every new post delivered to your Inbox

Join other followers: