Monthly Archives: May 2008

Invalid Parameter Error using Facebook Developer Toolkit 1.6

[UPDATE: June 3, 2008] Problem solved.
I’ve been playing with a Facebook Application started using my Facebook Developer’s Toolkit Starter Kit (for v1.6) and I’m seeing an “Invalid Parameter” error which occurs if the application is left idle in the browser then an attempt is made to interact with the app and the session times out. The error is as follows:

Server Error in ‘/FacebookASPNET’ Application.


Invalid parameter

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Facebook.Exceptions.FacebookException: Invalid parameter

Source Error:

Line 32:   else if (!String.IsNullOrEmpty(authToken))
Line 33:   {
Line 34:       _fbService.CreateSession(authToken);
Line 35:       Session["facebook_session_key"] = _fbService.SessionKey;
Line 36:       Session["facebook_userId"] = _fbService.UserId;

Source File: e:\web\nnn\htdocs\FacebookASPNET\Default.aspx.cs    Line: 34

Stack Trace:

[FacebookException: Invalid parameter]
   Facebook.API.FacebookAPI.ErrorCheck(XmlDocument doc) +900
   Facebook.API.FacebookAPI.LoadXMLDocument(String rawXML) +127
   Facebook.API.FacebookAPI.CreateSession() +92
   Facebook.Components.FacebookService.CreateSession(...) +37
   _Default.Page_Load(...) in Default.aspx.cs:34
   System.Web.Util.CalliHelper.EventArgFunctionCaller(...) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(...) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(...) +1436


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

The problem is discussed on the Facebook Developer’s Wiki here with the solution being to add the following code to allow for an IE issue regarding pages loaded in a frame from a different domain:

protected override void OnPreRender(EventArgs e) { Response.AppendHeader("P3P", "CP=\"CAO PSA OUR\""); base.OnPreRender(e); }

I’ve gone ahead and added this to my application but I’m still seeing this error. There are a number of discussions on the CodePlex project pages for the Toolkit related to this error message but AFAICT, it doesn’t appear this has been resolved at least not for IFRAME applications. In fact, the last message in this thread on the subject a user mentions switching to Facebook.NET which apparently doesn’t exhibit the same behavior. I haven’t had a chance to debug this further as I’m swamped with other work right now however, I thought it might be worth posting about to start gathering information about it. I’ll probably throw together a quick test using Facebook.NET for comparison and see what happens.

Anyway, have you run into this problem? Did the OnPreRender solution work? I’d like to update the starter kit as necessary to resolve this issue so if you have any details please let me know. Thanks!

Poor man's guide to locking down Windows XP

A

while ago, I found myself sitting at my Mom’s Windows XP computer staring at your typical family tech support nightmare. A nephew had been given access to the machine from the admin account and the result, as you might expect, was a disaster. Of course, the conversation started with “Hey, do you think you could look at our computer it seems awfully slow?”

Some advice, if you ever hear this question and the machine has a broadband connection look for any possible means to change the subject and start packing the car!

After attempting as best I could to clean things up and having no desire to install any additional software for fear of exacerbating an already terrible situation I opted to create a secondary “nephew” user account I could attempt to lock down. Armed with Internet Explorer and Google I searched for ways to disable certain Windows features in an effort to try and “protect” the new account. My focus was only things I could do with the registry since, again, I didn’t want to install any software. Without further adieu here is the list of registry tweaks I found and used in no particular order.

WARNING: If you use and/or apply any of this information it is entirely your responsibility, you assume ALL risk. You’ve been warned!

Btw, here’s great guide to the Windows registry for reference though not all of these items came from that site.

Hide or Display Administrative Tools Menu
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
Advanced]
Value Name: StartMenuAdminTools
Data Type: REG_SZ (String Value)
Value Data: Yes or No

Hide Control Panel, Printer and Network Settings
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoSetFolders
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Disable Drag-and-Drop on the Start Menu
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoChangeStartMenu
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disable restriction, 1 = enable restriction)

Remove Run from the Start Menu
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoRun
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Remove Tray Items from Taskbar
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoTrayItemsDisplay
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = enable restriction)

Disable the Change Password Button
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
System]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
System]
Value Name: DisableChangePassword
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Disable the Lock Workstation Button
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
System]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
System]
Value Name: DisableLockWorkstation
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Disable System Restore Tools and Settings
System Key: [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore]
Value Name: DisableConfig, DisableSR
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = enable restriction)

Disable the Ability to Right Click on the Desktop
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoViewContextMenu
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Screen Saver Password Protection Policy
User Key: [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\
Desktop]
Value Name: ScreenSaverIsSecure
Data Type: REG_DWORD (DWORD Value)

Remove the Security Tab
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoSecurityTab
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = enable restriction)

Remove the Hardware Tab
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoHardwareTab
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = enable restriction)

Disable the New Menu Item
In the registry find this key [HKEY_CLASSES_ROOT\CLSID\{D969A300-E7FF-11d0-A93B-00A0C90F2719}].

Rename it by placing a dash “-” in front of the GUID (the long bracketed value at the end.

Disable the Ability to Customize Toolbars
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoToolbarCustomize
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = enable restriction)

Remove File Menu from Explorer
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoFileMenu
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Hide the Network Neighborhood Icon
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
System Key: [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\
Explorer]
Value Name: NoNetHood
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = disabled, 1 = enabled)

Avoid Accidental Registry Imports with Regedit
Open your registry and find the key below.
Change the (Default) value to equal “edit”.
Exit your registry editor.

System Key: [HKEY_CLASSES_ROOT\regfile\shell]
Value Name: (Default)
Data Type: REG_SZ (String Value)
Value Data: edit

Disable Windows Installer
System Key: [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
Value Name: DisableMSI
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = admin only, 2 = disabled)

Restrict Installations from Removable Media
User Key: [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer]
Value Name: DisableMedia
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = enable restriction)

Protecting the iPod Touch with an Agent 18 Shield Case

Agent18 iPod Touch Shield Case

Following on my previous post, after a few months use I finally decided to pick up a case for my iPod Touch and many trips to the Apple store to test them out I selected the Agent18 Shield Case (pictured to the right). It’s a clear hard plastic case which snaps tightly around the device. While I really like it, it could use a thin rubber seal around the edges of all the openings as I tend to find pocket “crumbs” eventually make their way inside and get stuck between the case and the iPod. I looked at a number of other cases and settled on this one since it’s exterior is completely smooth and has no edges that can catch on clothing etc. I also like the fact that it snaps together easily with seems that run the entire length of the device. Aside from the minor “crumb” drawback I highly recommend it.

I’ve been debating about buying a screen protector but haven’t settled on anything yet. In fact, I still have the original static plastic cover intact but it’s starting to curl in spots. If you have any suggestions/recommendations I’d love to hear about them.

My answer to Apple's iPod Touch is it worth it?

So awhile ago I asked if the new iPod Touch was worth it and I got some good responses (thanks again, btw) although nothing that really pushed me to run out and get one at the time. My birthday was in the end of January and my wife decided to buy me a 16GB iPod Touch and after three+ months I think I can now the answer that question myself though it would be a “maybe” though definitely leaning towards yes. I say “maybe” because there are a few obvious features that are missing which I’ll mention in another post that would make it far more valuable although perhaps would cut into iPhone sales.

What I Like

The best feature by far is the nearly full fledged Safari browser coupled with the slick touch UI. It’s awesome to be able to surf the web naturally from such a small device. The browser provides quick access to apps like $g(Google Reader) and $g(Google Calendar) both of which I use heavily.

Second, would be the ability to quickly check several different email accounts though my work account, based on Exchange, is currently only accessible via the browser but that’s scheduled to change in June. I am, however able to use the simple Outlook Web Access site and check my work email.

Third, is the screen. Having such a high resolution screen in your pocket is huge. From full web pages to Google maps and YouTube videos it’s really awesome to have such rich display at your finger tips. Last weekend I demo’ed it to my Mom and after about a minute she was saying “I want one now!” and that’s coming from someone who is not the gadget type.

Conclusion

I believe the iPod Touch has huge potential even given some of things I think it’s lacking. I found this BusinessWeek article an interesting read and I would agree that it’s only a matter of time before we see more types of content appearing for the iPod Touch and iPhone. In fact, Google now has excellent support for the iPhone/Touch and I’m using their apps all the time now. When the $g(iPhone SDK) starts shipping we’ll see an explosion in the number of applications available which will only serve to make things even more interesting.

Generating MSDN style documentation using Sandcastle

ScrewTurn wiki with hosted MSDN style API documentation

To the right is a screenshot of MSDN style documentation created using Microsoft’s SandCastle and SandCastle Help File Builder (SHFB) which is generated as part of a Continuous Integration build running under CruiseControl.NET shown here hosted within a page on a ScrewTurn wiki at a client’s site.

The documentation was created for the EDI Invoicing system I developed. Originally, I’d simply followed the Thoughtworks style for documenting Tasks and Source Control providers but that proved rather time consuming and required a fair amount of hand editing. Using this mechanism the documentation on the wiki is always up-to-date and I don’t have to worry about maintaining lots of static content.

SandCastle Help File Builder to the Rescue

SandCastle Help File Builder GUI

Rather than using SandCastle, Microsoft’s oh-so-slowly-developing documentation tool for managed code, Eric Woodruff has created SHFB which gives SandCastle the user experience you’d expect from Microsoft itself. (btw, if you’re a Borland fan be sure to check out Eric’s Turbo Vision page for a trip down memory lane)

SHFB allows you to create a project, select the desired assemblies, and generated web based MSDN style documentation easily. In fact, SHFB allows you to select from three different web site styles. Be sure to read the Links to Resources section as there are a number of additional tools required. Of course, the same thing is possible with SandCastle itself and if you’re up for it check out this post for details.

Generating API Doc Under Continuous Integration

Since I didn’t want to have to manually regenerate the documentation I setup a CruiseControl.NET task to handle creating the documentation web site which also uses SHFB and looks like this:

<exec executable="C:\Program Files\EWSoftware\SHFB\SandcastleBuilderConsole.exe"> <baseDirectory>c:\work\utilities\edi\help</baseDirectory> <buildArgs>vtalk.shfb</buildArgs> <buildTimeoutSeconds>2400</buildTimeoutSeconds> </exec>

Adding this as a task ensures that the documentation is never out of date with the one minor downside being that the documentation isn’t available during the build but that’s really minor.

Conclusion

If you’ve been holding off using SandCastle or have been looking for tools to make it easier be sure to give SHFB a try as it worked like a charm for me.

What’s your experience with SandCastle been like? Have you tried it?

Borland completes the sale of CodeGear

The shoe finally dropped. My former employer Borland finally completed the sale of their CodeGear division. The sale is for $23M to Embarcadero Technologies of San Francisco a database tools company. After 16 years looks like I’ll finally be removing BORL from my watch list. It’s pretty quiet on the CodeGear Blogs on the subject and I have yet to hear from anyone on the inside. I wish them great success going forward!

Is it cool when top bloggers have to explain why it's cool?

If you’ve taken a peek at Microsoft Live Mesh would you leave a comment here and tell me what the big deal is? And what the hell is Steve Gilmor talking about? Seriously, read that article if you can get through it. I get the feeling that top bloggers like Gilmore and Scoble use all this social networking buzz like a proverbial hacky sack devised to simply keep a conversation afloat. Scoble even goes so far as say

Microsoft’s fans are delivered to the promised land.
  – Robert Scoble (link)

Where exactly is this promised land? Seriously, that’s out of touch given Mesh’s beta status, numerous missing features and a nebulous definition. Heck, I’m an MS fan and I just don’t get it. I’ve yet to come across a clear description of what Mesh really is or will be? My initial experience completely sucked. The other night I sat down for dinner with Barry Kelly and Adam Markowitz (Adam, you’ve been linked to so get that blog up!) and neither had a good understanding of Mesh and these are bright guys!

I’m actually glad or perhaps even relieved it confounds Joel as well. For now, I’ll take that as a good sign.

Anyway, .NET started out pretty nebulous and poorly defined but the end result has proven extremely satisfying so there is hope. I wonder if Microsoft felt compelled to release something in these days of exploding social networks simply to remain relevant and in the conversation which, in this case, somehow seems to have worked. IMO it seems Mesh was released so customers could try to help Microsoft to figure out exactly what to do with this technology as a number of pieces seems like a rehash of existing services.

Now, had Microsoft announced a Windows based, Amazon-like, elastic compute cloud that would have been really interesting.