Scott Hanselman

Unlocking Windows 8 "God Mode" - A Useful Trick but also Mysterious Nonsense

January 18, '13 Comments [42] Posted in Win8
Sponsored By

Everyone likes the idea of a cheat mode, or "God Mode." Many years ago - I think around 1993 - Doom introduced the idea of switching a player into God Mode within the game by typing IDDQD. You'd then be invincible and get to feel like you'd discovered an exciting secret "easter egg" in the game. How exciting the the developers hid this for us to find!

You may have heard of a "God Mode" hidden in the depths of Windows 8 (or 7 for that matter). The idea is that you make a folder somewhere, I like using my desktop, and name the folder "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" and it "unlocks" a bunch of secret functionality.

Let's try.

Make a God Mode Folder for Windows

Now I hit Enter...

God Mode looks a lot like the Control Panel

Hm, the folder icon looks like the Control Panel now, and the long GUID (Globally Unique Identifier) is gone.  Cool.

What's the properties for this folder say? Right Click, Properties. There's the Type with the GUID. It's not just a File Folder, it's a File Folder with some metadata associated..

God Mode is a folder with a GUID at the end

Where is this GUID in the Registry? Let's run Regedit.exe and Find it.

God Mode in the registry is a GUID pointing to the Control Panel

Ah, it's the All Tasks view of the Control Panel. By naming this folder this way, its view is now the Control Panel with All Tasks shown.

But 'GodMode?' That is a little dodgy as a name, right? That might offend. Is it needed? Let me rename it to MagicPants.

You can name the GodMode folder whatever you want

Does it still work? Sure. I can call it whatever I need.

I renamed my folder "Magic Pants"

Is there a reason to have this "All Tasks" folder? No. It's just a view on a list of control panel tasks you already have.

See there where it says "add clocks for different time zones?" What if I just press the Start Button and type "add clocks" and click on Settings?

You can already search settings for ALL these Control Panel tasks

The Control Panel tasks are searched from the Start Screen's settings already. They always have been, even in Windows 7.

If you like the idea of an "All Tasks" or "God Mode" folder, be happy and make yourself one on your desktop. If not, know that ALL those features are already there. Just press the Windows button, type something, and hit settings. If you're a hotkey person, you can press Windows Key + W and access any of these 265 (and growing) helpers to customize your system.

Some cool examples, search for "RAM"

Search for RAM

or "Fonts"

Search for Fonts

or "Mouse"

Search for Mouse

Either way, enjoy the God Mode that your computer already has, or feel free to customize your machine to your heart's content.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Missing Windows 8 Instructional Video

January 12, '13 Comments [68] Posted in Screencasts | Win8
Sponsored By

A few months ago while sitting at a Burger King (yes, I know) I recorded a video on "How to use Windows 8 in 3 minutes" and threw it up on YouTube. It's been viewed nearly a half million times. Eek. It's got poor audio, and it's WAY too fast. I did it on a goof. However, people keep showing it to family and friends.

A man emailed me after sending it to his elderly uncle and let's just say that the uncle wasn't impressed with the speed of the video either. It's great for geeks but not for normal people.

So tonight I took a few hours and did a new video that I'm VERY happy with and I hope you enjoy it. It's clean, clear, and only 25 minutes long and it explains, I believe, Windows 8 and its changes for anyone with basic Windows experience.

I hope you like it and you share it with family and friends. Also check out the related posts at the bottom.

The Missing Windows 8 Instructional Video - 25 minutes

Related Posts you may enjoy

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

NuGet Package(s) of the Week #12 - Accessing Google Spreadsheets with GData from C# *and* hosting Razor Templates to generate HTML from a Console App

January 10, '13 Comments [22] Posted in ASP.NET MVC | Back to Basics | NuGet | NuGetPOW | Open Source
Sponsored By

The Red Pump Project

Sometimes I write apps for charities on the side. Recently I've been doing some charity coding on the side for The Red Pump Project. They are a non-profit focused on raising awareness about the impact of HIV/AIDS on women and girls. I encourage you to check them out, donate some money, or join their mailing list.

Side Note: Folks often ask me how they can get more experience and wonder if Open Source is a good way. It is! But, charities often need code too! You may be able to have the best of both worlds. Donate your time and your code...and work with them to open source the result. Everyone wins. You get knowledge, the charity get results, the world gets code.

Anyway, this charity has a Google Spreadsheet that holds the results of a survey of users they take. You can create a Form from a Google Spreadsheet; it's a very common thing.

In the past, they've manually gone into the spreadsheet and copied the data out then painstakingly - manually - wrapped the data with HTML tags and posted donors names (who have opted in) to their site.

It got the point where this tedium was the #1 most hated job at The Red Pump Project. They wanted to recognize donors but they aren't large enough yet to have a whole donation platform CRM, instead opting to use Google Apps and free tools.

I figured I could fix this and quickly. Over a one hour Skype last night with Luvvie, one of The Red Pump Founders, we 'paired' (in that I wrote code and she validated the results as I typed) and made a little app that would loop through a Google Spreadsheet and make some HTML that was then uploaded to a webserver and used as a resource within their larger blogging platform.

Yes there are lots of simpler and better ways to do this but keep in mind that this is the result of a single hour, paired directly with the "on site customer" and they are thrilled. It also gives me something to build on. It could later to moved into the cloud, automated, moved to the server side, etc. One has to prioritize and this solution will save them dozens of hours of tedious work this fund raising season.

Here's our hour.

Step 1 - Access Google Spreadsheet via GDATA and C#

I was not familiar with the Google GData API but I knew there was one.  I made a console app and downloaded the Google Data API installer. You can also get them via NuGet:

image

I added references to Google.GData.Client, .Extensions, and .Spreadsheets. Per their documentation, you have to walk and object model, traversing first to find the Spreadsheet with in your Google Drive, then the Worksheet within a single Spreadsheet, and then the Rows and Columns as Cells within the Worksheet. Sounds like moving around a DOM. Get a reference, save it, dig down, continue.

So, that's Drive -> Spreadsheet -> Worksheet -> Cells (Rows, Cols)

The supporters of the Red Pump Project call themselves "Red Pump Rockers" so I have a class to hold them. I want their site, url and twitter. I have a "strippedSite" property which will be the name of their site with only valid alphanumerics so I can make an alphabet navigator later and put some simple navigation in a sorted list.

public class Rocker
{
public string site { get; set; }
public string strippedSite { get; set; }
public string url { get; set; }
public string twitter { get; set; }
}

Again, this is not my finest code but it works well given constraints.

var rockers = new List<Rocker>();

SpreadsheetsService myService = new SpreadsheetsService("auniquename");
myService.setUserCredentials(gmaillogin@email.com, "password");

// GET THE SPREADSHEET from all the docs
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = myService.Query(query);

var campaign = (from x in feed.Entries where x.Title.Text.Contains("thetitleofthesheetineed") select x).First();

// GET THE first WORKSHEET from that sheet
AtomLink link = campaign.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
WorksheetQuery query2 = new WorksheetQuery(link.HRef.ToString());
WorksheetFeed feed2 = myService.Query(query2);

var campaignSheet = feed2.Entries.First();

// GET THE CELLS

AtomLink cellFeedLink = campaignSheet.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null);
CellQuery query3 = new CellQuery(cellFeedLink.HRef.ToString());
CellFeed feed3 = myService.Query(query3);

uint lastRow = 1;
Rocker rocker = new Rocker();

foreach (CellEntry curCell in feed3.Entries) {

if (curCell.Cell.Row > lastRow && lastRow != 1) { //When we've moved to a new row, save our Rocker
rockers.Add(rocker);
rocker = new Rocker();
}

//Console.WriteLine("Row {0} Column {1}: {2}", curCell.Cell.Row, curCell.Cell.Column, curCell.Cell.Value);

switch (curCell.Cell.Column) {
case 4: //site
rocker.site = curCell.Cell.Value;
Regex rgx = new Regex("[^a-zA-Z0-9]"); //Save a alphanumeric only version
rocker.strippedSite = rgx.Replace(rocker.site, "");
break;
case 5: //url
rocker.url = curCell.Cell.Value;
break;
case 6: //twitter
rocker.twitter = curCell.Cell.Value;
break;
}
lastRow = curCell.Cell.Row;
}

var sortedRockers = rockers.OrderBy(x => x.strippedSite).ToList();

At this point I have thousands of folks who "Rock The Red Pump" in a list called sortedRockers, sorted by site A-Z. I'm ready to do something with them.

Step 2 - Generate HTML (first wrong, then later right with Razor Templates)

They wanted a list of website names linked to their sites with an optional twitter name like:

Scott's Blog - @shanselman

I started (poorly) with a StringBuilder. *Gasp*

This is a learning moment, because it was hard and it was silly and I wasted 20 minutes of Luvvie's time. Still, it gets better, keep reading.

Here's what I wrote, quickly, and first. Don't judge, I'm being honest here.

foreach (Rocker r in sortedRockers){
string strippedName = r.strippedSite;

if (char.ToUpperInvariant(lastCharacter) != char.ToUpperInvariant(strippedName[0])) {
sb.AppendFormat("<h2><a name=\"{0}\">{0}</a></h2>", char.ToUpperInvariant(strippedName[0]));
}

sb.AppendFormat("<a href=\"{1}\" target=\"_blank\">{0}</a>", r.site, r.url);

if (!string.IsNullOrWhiteSpace(r.twitter)){
r.twitter = r.twitter.Replace("@", "");
sb.AppendFormat(" &mdash; <a href=\"http://twitter.com/{0}\">@{0}</a>", r.twitter);
}
sb.AppendFormat("<br>");

lastCharacter = strippedName[0];
}
sb.AppendFormat("</body></html>");

This works fine. It's also nuts and hard to read. Impossible to debug and generally confusing. Luvvie was patient but I clearly lost her here.

I realized that I should probably have used Razor Templating from within my Console App for this. I asked on StackOverflow as well.

UPDATE: There's a great answer by Demis from ServiceStack on StackOverflow showing how to use ServiceStack and Razor to generate HTML from Razor templates.

I ended up using RazorEngine, largely because of the promise of their first two lines of code on their original home page.  There is also RazorMachine, Nancy, and a post by Andrew Nurse (author of much of Razor itself) as other options.

RazorEngine in NuGet

But, these two lines right at their top of their site were too enticing to ignore.

string template = "Hello @Name.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });

(Open Source Developers Take Heed: Where's the easy quickstart code sample on your home page?)

This allowed me to change all that StringBuilder goo above into a nice clear Razor template in a string. I also added the alphabet navigation and the letter headers easily.

<html><head><link rel="stylesheet"" href="style.css" type="text/css" media="screen"/></head><body>

//Navigation - A B C D, etc.
@foreach(char x in ""ABCDEFGHIJKLMNOPQRSTUVWXYZ"".ToList()) {
<a href=""#@x"">@x</a>
}

@functions {
//need @functions because I need this variable in a wider scope
char lastCharacter = '0';
}

@foreach(var r in Model) {
var theUpperChar = char.ToUpperInvariant(r.strippedSite[0]);

//Make a capital letter "heading" when letters change
if (lastCharacter != theUpperChar) {
<h2><a name="@theUpperChar">@theUpperChar</a></h2>
}

<a href="@r.url" target="_blank">@r.site</a>

if (!string.IsNullOrWhiteSpace(r.twitter)) {
var twitter = r.twitter.Replace("@", String.Empty);
<text>&mdash;</text> <a href="http://twitter.com/@twitter">@twitter</a>
}
<br/>
lastCharacter = theUpperChar;
}
</body></html>

And the "do it" code ended up being:

string result = Razor.Parse(template, sortedRockers);
File.WriteAllText("2013list.html", result);

StringBuilders are fine, to a point. When it gets hairy, consider a templating engine of some kind.

Step 3 - Upload a File with FTP with C#

Now what? They want the little app to upload the result. Mads Kristensen to the rescue 7 years ago!

private static void Upload(string ftpServer, string userName, string password, string filename)
{
using (System.Net.WebClient client = new System.Net.WebClient())
{
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.UploadFile(ftpServer + "/" + new FileInfo(filename).Name, "STOR", filename);
}
}

Then it's just

Upload("ftp://192.168.1.1", "UserName", "Password", @"2013list.html");

Conclusion

You can see that this is largely a spike, but it's a spike that solves a problem, today. Later we can build on it, move it to a server process, build a front end on it, and come up with more ways for them to keep  using tools like Google Spreadsheet while better integrating with their existing websites.

Consider donating your coding time to your favorite local charity today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

2012 Archive of Hanselman's Newsletter of Wonderful Things

January 8, '13 Comments [5] Posted in Newsletter
Sponsored By

I have a "whenever I get around to doing it" Newsletter of Wonderful Things. Why a newsletter? I dunno. It seems more personal somehow. Fight me.

Still, it's one more site to check and it's a hassle for some of you  Dear Readers. Therefore, I will still do the newsletter, but I'll post each newsletter to the blog a week or so later.

Here's 2012's Archive of Wonderful Things' Newsletters as a way to kick it off.


Hanselman's Newsletter of Wonderful Things: November 9th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: October 20th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: October 8th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: September 12th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: August 22nd, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down athttp://www.tinyletter.com/hanselman.

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: August 2nd, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: July 5th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: June 12th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: May 30th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week.

If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: May 16th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week.

If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: May 9th, 2012

Hi Interfriends,

Thanks again for signing up for this experiment. This is my fifth newsletter. Here's some interesting things I've come upon this week.

If you forwarded this (or if it was forwarded to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: May 2nd, 2012

Hi friends,

Thanks again for signing up for this experiment. This is my fourth newsletter - I hope I'm not boring you yet.

This is a place for me to include some things that are on my mind as well as fun or interesting links I come upon as well as ideas that aren't ready for prime time. No, I have no master plan. Just having fun. :)

Here's some interesting things I've come upon this week.

If you forwarded this email (or if it was forward to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: April 24, 2012

Hi friends,

Thanks again for signing up for this experiment. This is my third newsletter - I hope I'm not boring you.

This is a place for me to include some things that aren't usually in my blogs or tweets. Things that are on my mind as well as fun or interesting links I come upon as well as ideas that aren't ready for prime time.

Here's some interesting things I've come upon this week.

Please feel free to forward. If you forwarded this email (or if it was forward to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Be well, write good code, and stay in touch,

Scott Hanselman


Hanselman's Newsletter of Wonderful Things: April 12, 2012

Hi friends,

Thanks again for signing up for this experiment. This is a place for me to include some things that aren't usually in my blogs or tweets. Things that are on my mind as well as fun or interesting links I come upon as well as ideas that aren't ready for prime time.


Please feel free to forward. If you forwarded this email (or if it was forward to you) a reminder: You can sign up or sign down at http://www.tinyletter.com/hanselman.

Here's some interesting things I've come upon this week.

And finally, if you collect links and good reading like these, I really recommend you start using Instapaper with your mobile devices. Save items for later with the bookmarklet in your browser, and read them whenever on your mobile devices. I have no affiliation with Instapaper.

Be well, write good code, and stay in touch,

Scott Hanselman


The First One

Hi friends,

I hope you're well. Thanks for signing up for this experiment. I thought I'd include some things that aren't usually in my blogs or tweets. Things that are on my mind as well as fun or interesting links I come upon. I'll also try sending "preview blog posts." By this I mean when I'm working on a new idea but it's not totally fleshed out, perhaps I can run it by you guys first.

That's all for now.

Scott

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How to keep your ASP.NET database connection strings secure when deploying to Azure from Source

January 8, '13 Comments [13] Posted in ASP.NET | Azure
Sponsored By

I was working with Rob Conery today during lunch moving the This Developer's Life podcast website to Git. We recorded the whole upgrade and migration experience and it will be up as a video on TekPub soon.

Shameless Plug: Check out my TekPub show "The Source" available on TekPub.tv.

A question came up during the deployment. We moved our database from SQL Compact to a SQL Server instance in Azure. But, how do we keep our database connection strings a secret? We are pushing our source code to GitHub and don't want our connection strings and passwords committed as well.

Sometimes you'll make a Web.Release.Config file and keep them in there. Sometimes you'll make a connectionStrings.config and refer to it from the web.config but never deploy it.

However, Azure lets you keep those configuration settings in Azure securely so they never end up in code. Note the screenshot below. There's a Connection String named "TDL." This matches the name that we reference in code and the name of the connection string in our web.config.

Azure hides connection strings

Our ASP.NET Web Pages database call was to Database.Open in WebMatrix.Data. It's pretty simple. Dead simple, in fact.

var db = Database.Open("TDL");

This used to refer to a TDL.sdf SQL Server Compact Edition (SQL CE) file. Then we moved it into a connection string.

<connectionStrings>
<add name="TDL" connectionString="blah blah" providerName="yada yada"/>
</connectionStrings>

The idea is that if your Azure configuration (as seen in the screenshot above) has an value with the same name, that secure value from Azure will get replaced when your app is deployed.

GOTCHA WARNING: I spent twenty minutes trying to figure out why my value wasn't getting updated. My app was was acting as if there was no connection string value at all. I was getting "Connection string "TDL" was not found." After much gnashing of teeth I discovered (thanks to David Ebbo's help) that I had put my <connectionStrings> element inside of <runtime> within the web.config and the error was being swallowed. Apparently that section is pretty relaxed about elements it doesn't understand - certainly more relaxed that the system.web section. Regardless, in the hope that it save some visitor (perhaps you!) time, make sure your connectionStrings element is right at the tine under <configuration/>

All in all, this worked very well for us.

Git Deployments from GitHub directly into Azure

It let us put our code on GitHub, setup automatic deployment to Azure directly from GitHub, while still keeping our SQL connection strings (and any additional production settings) private.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.