Azure Tip #1 – Getting Started

Posted December 9, 2009 by Tom Krueger
Categories: Windows Azure

Technorati Tags:

It is time to get started with developing and deploying applications to the cloud with the Windows Azure Platform.  Azure will be in production in January and free to use until February which means this is the perfect time to start learning since it is basically production ready now but you don’t have to pay for it.  This post is the first in a series of upcoming tips.  I have been playing around with Azure on the side for a few months now and would like to share some of the things that I have and will run into.  To get started, here are a few suggestions on what I would do to get a feel for Azure if I were to do it again.

Sign Up for an Azure Account

  • You will want to get access to both Windows Azure and SQL Azure to start.  You will need a Windows Live id that both of the accounts will get linked to.  The Windows Azure account was setup immediately for me, but I had to wait 2 days to receive my SQL Azure registration token.  http://www.microsoft.com/windowsazure/account/

Setup Development Environment

  • Get a Machine or VPC with Windows 7 or Windows Server 2008 R2.  I personally started with Server 2008 on a VPC but it was so darn slow.  Instead of dealing with the performance I decided to try out Windows 7 and boot to VHD. Go for Windows 7, it is so fast even when booting to VHD.
  • Choose your IDE.  I chose Visual Studio 2008, however, they say 2010 will work as well.
  • Download & Install Windows Azure Tools for Microsoft Studio
  • Download & Install Windows Azure SDK
  • You could also install the AppFabric, however, it is not necessary and it is something I personally would wait until you are comfortable with Azure.
  • Downloads Page (This link will likely be valid longer than the ones above.)

Watch / Listen

Things to Try it Out

  1. Connect to SQL Azure 
    1. Through SQL Management Studio
    2. Using ADO.NET from your desktop
    3. Using ADO.NET from a deployed Web or Worker Role
  2. Deploy a Web Role
  3. Deploy a Worker Role
  4. Take an existing application and move it to Azure
    1. Create the database schema on SQL Azure
    2. Deploy the web application to Staging

This tip consisted mostly of ideas on things to try and links to resources.  In future tips I will start to go through some of these items individually in more detail.

Resources

Props to Karl Shifflett

Posted June 14, 2009 by Tom Krueger
Categories: Uncategorized

I just attended the WPF – Line of Business conference in Chicago where Karl Shifflett was presenting.  The conference was incredible, probably the best I have attended and I hope to post on that later (but no promises).  Right now, I felt compelled to give props to Karl.  This guy is so enthusiastic about WPF he not only gets you more excited about this awesome product, he inspires you.  Oh yeah, he is very knowlegable, but there are lots of knowlegable people.  Karl takes it above and beyond,  by sharing his knowledge with you as if you were his best friend.  This guy takes your problem and turns it around for you as sample during the conference and even late into the night after you have gone as he did here for another attendee: http://karlshifflett.wordpress.com/2009/06/13/wpf-float-buttons-over-web-browser-control/.

Karl, you are the bomb!

ASP.NET MVC RenderPartial is replacing the entire page

Posted May 17, 2009 by Tom Krueger
Categories: .NET, ASP.NET MVC

I ran into an issue using RenderPartial that was in the end simple to solve but took a bit of time to figure out.

Situation

You have your let’s call it the “parent view” that has the Ajax.BeginForm on it as well as the div where you are rendering the partial view by using Html.RenderPartial.  When you load the page you see all of the content of your master page, the “parent view”, as well as the partial view.  Fantastic.  Now you submit the form by clicking a button or however you are doing it so that the partial view controller method is called.  This controller method is returning something like PartialView(“PartialViewName”, viewData);.  All seems to be working great, and then the browser ends up only displaying the contents of the partial view.  Hey, what happened to the master page and the “parent view” content.

As I understand it, the Ajax.BeginForm works is by calling java script functions in MicrosoftAjax.js and/or MicrosoftAjaxMVC.js.  I say and/or because I know that you need them both, however, I did not dig into how it all works nor do I really care. ( That is until the next problem :) )

Solution

In the end the solution is simple.  Just make sure that you reference the proper java script files.  I ended up putting them in my master page as follows:

<head runat="server">
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>

Hope that saves you some hair!
Tom

How To Load XML values into a PL/SQL Collection.

Posted January 27, 2009 by Tom Krueger
Categories: Oracle PL/SQL, Software Development

Tags: , , ,

The following example demonstrates how to load a PL/SQL table type collection from xml utilizing “bulk collect” and XMLSequence.

declare
   -- Declare collection type to bulk load into.
   type document_rt is record (
        doc_id         number,
        doc_name       varchar2(255)
        );
   type documents_tt is table of document_rt;

   docsXml        xmltype;
   docTable       documents_tt;
   docRecord      document_rt;
begin

   -- Create Example Xml for documents.
   docsXml := xmltype(
         '<Documents>'
      || '  <Document>'
      || '    <Id>111</Id>'
      || '    <Name>First Document</Name>'
      || '  </Document>'
      || '  <Document>'
      || '    <Id>222</Id>'
      || '    <Name>Second Document</Name>'
      || '  </Document>'
      || '</Documents>');

   -- Bulk load the docTable collection based on the xml.
   select extractValue( value( t ), 'Document/Id' ) doc_id,
          extractValue( value( t ), 'Document/Name' ) doc_name
     bulk collect into docTable
     from table( XMLSequence(
                    extract( docsXml, 'Documents/Document') ) ) t;

   -- Loop through collection to display results.
   if docTable.count > 0 then
      for i in docTable.FIRST..docTable.LAST loop
         docRecord := docTable( i );
         dbms_output.put_line( 'Id: ' || docRecord.doc_id );
         dbms_output.put_line( 'Name: ' || docRecord.doc_name );
      end loop;
   end if;
end;

Output

Id: 111
Name: First Document
Id: 222
Name: Second Document

Escaping a curly braces in String.Format

Posted December 31, 2008 by Tom Krueger
Categories: .NET

Tags: ,

If you ever recieve the error “Input string was not in correct format.” check the string for curly braces.  Since String.Format uses curley braces to denote the replacement positions you need to escape them.  To do so all you need to do is replace the single curley brace ’{‘ with a double ‘{{‘.

Example:
Bad    – String.Format(“{Somthing To Format ’{0}’}”, something);
Good – String.Format(“{{Somthing To Format ’{0}’}}”, something);

Where’s My WCF WSDL?

Posted December 30, 2008 by Tom Krueger
Categories: Uncategorized

Ran into an issue the other day where I was not able to find the WSDL for a new WCF service.  Tried navigating to the WSDL through the browser and all I got was a blank page.  Knowing that WCF doesn’t have to provide a WSDL I verified that things were configured properly for expsoing it.  Everything else worked, I could connect to it from my WCF client application and through the WCF Test Client.  Luckily I basically copied the service definition from another service and I was able to identify a missing foward slash at the end of the base address.  Surprisingly that was the missing piece.  So make sure that base address ends with a forward slash.

<service behaviorConfiguration=Xyz.ServiceBrokerBehavior
                  
name=Xyz.SomeService>
  <
host>
   
<baseAddresses>
     
<add baseAddress=http://localhost:9090/Xyz/SomeService/  />
    </
baseAddresses>
 
</host>
  <
endpoint address=SomeService
                        
binding=basicHttpBinding
                        
bindingConfiguration=DefaultHttpBindingConfig
                        
name=SomeServiceHttp
                        
contract=Xyz.ISomeService />
  <
endpoint address=mex
                        
binding=mexHttpBinding
                        
name=Mex
                        
contract=IMetadataExchange />
</
service>

btw – In my search to figure out this problem I found a nice article by Keith Elder.  About half way down there is a section titled “Exposing Our Service’s WSDL”.  http://www.keithelder.net/blog/archive/2008/01/17/Exposing-a-WCF-Service-With-Multiple-Bindings-and-Endpoints.aspx

Hope this saves you some hair,
Tom

Unit Tests Hanging in Visual Studio 2008

Posted December 24, 2008 by Tom Krueger
Categories: Uncategorized

For some time now I have been dealing with unit tests in Visual Studio 2008 hanging.  The unit test goes to Pending state and then just hangs there.  At first I was restarting Visual Studio to resolve the issue but then that got to be too often so I found that if you kill VSTestHost.exe and re-run the test it works.  Ok, that was fine for a while, but today I was about fed up with it so I search a bit.  At this point you are probably thinking that there is a happy ending with a nice solution.  Well maybe.  I did find a post that describes the same problem so others are having this issue and at some point in the future the resolution may be posted there  (the link is below).  However, the solution may be in VS 2008 SP1 I still havn’t installed that.  Anyway just wanted to make sure others know to kill the VSTestHost.exe instead of restarting Visual Studio.

http://stackoverflow.com/questions/50746/visual-studio-2008-randomly-hangs-on-test-run#391866

Merrry Christmas!

How To Call a Web Service from Oracle PL/SQL

Posted September 17, 2008 by Tom Krueger
Categories: Oracle PL/SQL

Tags: ,

I would like to say that calling a web service has been made easy with Sys.UTL_DBWS package but it took me a bit of time to get it right.  This biggest issue that I ran into is that the samples that I found online and in the forums simply don’t work.  The sample below was provided by Oracle support and helped a lot in getting started so I thought that I would pass it along.  The sample uses a public web service so if the service is still running this code should just work for you.  My ultimate goal was to call a Microsoft WCF service which I have been able to do and plan to post the code soon.

function get_joke
return varchar2
is
  service_           sys.utl_dbws.SERVICE;
  call_              sys.utl_dbws.CALL;
  service_qname      sys.utl_dbws.QNAME;
  port_qname         sys.utl_dbws.QNAME;
  xoperation_qname   sys.utl_dbws.QNAME;
  xstring_type_qname sys.utl_dbws.QNAME;
  response           sys.xmltype;
  request            sys.xmltype;
begin
  service_qname := sys.utl_dbws.to_qname(null, 'getJoke');
  service_ := sys.utl_dbws.create_service(service_qname);
  call_ := sys.utl_dbws.create_call(service_);
  sys.utl_dbws.set_target_endpoint_address(call_, 'http://interpressfact.net/webservices/getjoke.asmx');
  sys.utl_dbws.set_property( call_, 'SOAPACTION_USE', 'TRUE');
  sys.utl_dbws.set_property( call_, 'SOAPACTION_URI', 'http://interpressfact.net/webservices/getJoke');
  sys.utl_dbws.set_property( call_, 'OPERATION_STYLE', 'document');
  request := sys.xmltype(
       '<getJoke xmlns="http://interpressfact.net/webservices/">'
    || '<Category>Excuses-10</Category>'
    || '</getJoke>');
  response :=sys. utl_dbws.invoke(call_, request);
  return response.extract('//getJokeResult/child::text()', 
    'xmlns="http://interpressfact.net/webservices/"').getstringval(); 
end;

Resources

Mouse is Choppy in Virtual PC

Posted August 20, 2008 by Tom Krueger
Categories: Virtual PC

Tags: , , ,

Recently I bought a new Dell XPS laptop and installed Microsoft Virtual PC so that I could use my existing virtual hard drives.  Everything went smoothly with one exeption, my mouse was choppy.  As I moved across the screen the mouse studdered a bit, which was enough to be incredibly anoying especially once I started working.  Down to the solution. 

I first increased the mouse Sampling Rate from 100 to 200.  This seemed to help but I still wasn’t satisfied.  I then increased the Input Buffer Length to 300.  It was hard to tell, but I believe this also helped.  It is unfortunate that you have to reboot after making the changes because it is difficult to see the differences.  I ended up deciding that it was good enough at these new settings.

To access these settings:
Control Panel -> Mouse -> Hardware Tab -> Properties -> Advanced Settings

Issues when Visual Studio 2008 SP1 is installed on Team Foundation Server 2008.

Posted August 15, 2008 by Tom Krueger
Categories: Team Foundation Server, Visual Studio

Tags: , , , ,

We are running TFS 2008 and installed the recent service pack for Visual Studio (Visual Studio 2008 SP1) on the same server that TFS is running.  At first everything was fine, actually we went an entire day without any trouble.  However, when we arrived at work the next morning, we found TFS was logging a bunch of errors. 
 
From Team Explorer we were receiving the following error:

  • TF30331: Team Explorer could not connect to Team Foundation server…TF30059: Fatal error while initializing web service.

The event log was filled with the following errors:

  • TF53010: The following error has occurred in a Team Foundation component or extension:
  • TF53013: A crash report is being prepared for Microsoft. The following information is included in that report:
  • The Team Foundation warehouse service was unable to initialize Web Request
       Details Url: http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx

Initially we found this post (Error installing SP1 – TFS Left in Broken State) and wasted time trying to figure out if stopping the web sites would help us like it helped the posters.  Then we tried repairing TFS through add/remove programs.  This was looking promising until about 95% of the way through when we encountered “Error 28002” in a dialog box.  The event log error for this was:

TF213000: A required user account could not be added during installation or repair of Team Foundation Server.  The installation or repair failed with the following exception message: blah blah.
 
Finally broke down and called Microsoft for my first time ever.  The whole team was down so it had to be done.

This apparently is a recently known issue and they just posted a KB article on the day before.  I sure wish that would have shown up in search.  Anyway the resolution was to install the service pack for Team Foundation Server (Team Foundation Server 2008 SP1).  Amazingly it worked beautifully.  It didn’t need a reboot, didn’t need to restart IIS, nothing it just worked.  Sweet!  We did reboot the server anyway to make sure that two days from now we wouldn’t run into something else.
 
Microsoft KB Article – TFS 2008/ Not able to connect to TFS 2008 after installing Visual Studio 2008 SP1 

Hope this saved you some time,
Tom

SQL Server 2005 – Moving System Databases

Posted June 7, 2008 by Tom Krueger
Categories: Software Development

I have recently had SQL Server 2005 setup by a web host, however, they kept the system databases on the C: drive, which in my book is a no no.  I am not a DBA so I don’t know everything but my main reasons for moving these databases are:

1) For performance, you want your data(.mdf) and log(.ldf) files on separate drives.
2) Due to limited space on the C: drive, these files need room to grow.  Especially tempdb.
3) Keeping the house clean.  It is nice to have all the server files that need to be backed up in a single spot. (i.e. web site, email, database, etc.)

Moving these databases is not a trivial task.  There does appear to be a little bit of work that could be error prone if done manually.  So, it was very nice to stumble across an article by Vince Iacoboni who describes the process and provides a script to make the change.  The great thing about Vince is he is active in the discussion board regarding his article and script.

Moving the SQL 2005 System Databases

.NET Language Specifications

Posted June 7, 2008 by Tom Krueger
Categories: Uncategorized

How to manage IIS 6.0 from Vista

Posted June 7, 2008 by Tom Krueger
Categories: IIS, Software Development, Windows

Tags: , , , ,

If you find yourself needing to RDP into an IIS 6.0 web server to manage some of the IIS settings you will find the older IIS 6.0 management console useful.  This console will allow you to manage multiple IIS 6.0 servers from your desktop which will be faster to access (opposed to logging into the server) and more importantly won’t consume an RDP session that someone else may need.  
 

  • Navigate through: Control Panel –> Programs –> Turn Windows Features on or off
  • Expand: Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility
  • Select: IIS 6 Management Console

 

 To Access

  • Navigate through: Administrative Tools -> IIS 6 Manager
  • Right Click: Internet Information Services -> Connect
  • Enter Server Name

 
 Here is a blog that walks you through the install in detail

http://blogs.iis.net/chrisad/archive/2007/01/03/managing-iis-6-0-servers-from-windows-vista-and-other-management-stuff.aspx

  

Windows Blocked Files Error

Posted April 6, 2008 by Tom Krueger
Categories: Windows

Error Message
“Windows cannot access the specified device, path, or file.  You may not have the appropriate permissions to access the item.”

This message isn’t entirely accurate and frustrating when you forget what the simple resolution is.  In many cases to resolve this, you simply need to unblock the file from the file’s properies window.

To do so:
1) Right-Click on file and Select Properties
2) Select the General Tab.
3) Click the Unblock button.

The first time I recieved this message I pulled out some of my hair after trying the file on multiple machines and different versions of Windows, checking security, etc.  I was being smarter than I actually was which led to taking this simple problem to a major one.  Anyway, if you are searching for this error and found this page, chances are that I have saved you some hair as well.

Visual Studio and Beyond Compare. Nice!

Posted March 18, 2008 by Tom Krueger
Categories: Visual Studio

Tags: , , ,

Ever wonder how to use Beyond Compare as the default comparison tool with Visual Studio?  I do every time I install a Visual Studio again.  Here is a post from a friend of mine on how to do this.

Changing the diff/merge program used by Visual Studio

Thanks Shaun!

What’s This? No Intellisense for WPF’s Xaml View.

Posted March 18, 2008 by Tom Krueger
Categories: .NET, WPF

Tags: , , ,

I swear that the Xaml view had intellisense at one point. What is going on? Well apparently there is a problem where the intellisense stops working after installing an SDK or MSDN. In my case I believe this occurred after installing the .NET 2.0 Framework SDK. Great news though, there is a fix thanks to Brett Kilty of Microsoft.

To fix this you need to set the Default string value to the path of your TextMgrP.dll for the key “HKEY_CLASSES_ROOT\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32”.

Here are the steps I executed to fix this:
1) Opened regedit
2) Searched for ‘{73B7DC00-F498-4ABD-AB79-D07AFD52F395}’
3) Expanded the key and clicked InProcServer32
4) The Default string was empty so I set it to ‘C:\Program Files\Common Files\Microsoft Shared\MSEnv\TextMgrP.dll’
5) Restarted Visual Studio
6) Smiled

btw – I’m running Visual Studio Professional 2008.

Link to Brett’s Post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2840817&SiteID=1

It’s Official: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2892404&SiteID=1 

Thanks Brett!

Don’t Name User Controls and Web Pages the Same.

Posted November 1, 2007 by Tom Krueger
Categories: .NET, Software Development

After spending some time developing an application using Visual Studio 2005 without the use of IIS I accumulated quite a few user controls and web pages that worked great in the dev environment.  However, after moving them to IIS I encountered a tricky little problem.  The error was:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0030: Cannot convert type ‘ASP.menu_aspx’ to ‘System.Web.UI.WebControls.Menu’

Source Error:

Line 118:        public menu_aspx() {
Line 119:            string[] dependencies;
Line 120: ((Menu)(this)).AppRelativeVirtualPath = "~/Menu.aspx";
Line 121: if ((global::ASP.menu_aspx.@__initialized == false)) {
Line 122: dependencies = new string[6]; 

After playing around a bit I found that the user control worked fine if the page wasn’t the same name as the control.  Arg.  I don’t want to rename my aspx files because those are the names in the url.  I also didn’t want to rename the user controls either. 

So what’s the fix. 
Well as far as I can tell the quick fix is to rename the web page class name (i.e. not the aspx file name). 

Menu.aspx.cs – (Appended ‘Page’ to the class name.)
public partial class MenuPage : System.Web.UI.Page

Menu.aspx – (Also needed to update Inherits to match.)
<%@ Page Language=”C#” CodeFile=”Menu.aspx.cs” Inherits=”MenuPage %>

If anyone finds a better way to solve, please post a comment.

Domain Registrar Analysis for International Domains

Posted October 11, 2007 by Tom Krueger
Categories: Entrepreneur

Tags: , , ,

If you ever need to get familiar with the landscape of domain registrars that handle international domain registration you must read Rajat’s post titled ”International Domain Acquistion“.  He poses a few key factors to evaluate your registrar on and then provides the analysis work of 9 familiar registrars.  Nice work Rajat, we all appreciate it!

Opening a Windows Command Prompt from Windows Explorer

Posted September 10, 2007 by Tom Krueger
Categories: Uncategorized

Do you ever find yourself navigating 10 folder deep in Windows Explorer and wishing there was an easy way to open a command prompt to your current location.  Yeah, me to.  I remember years ago someone showing me that they could do this through a right-click selection on a folder, however, I had forgotten how.  That is, until today when I was looking down the list of tools available in the Windows Server 2003 Resource Kit Tools and saw this little gem “Cmdhere.inf: Command Here“.  I instantly had a flashback of those fond memories of watching this person use this wonderful tool. 

Usage
The use of the tool is extremely simple.  Once you have installed the Cmdhere.inf file that comes with the resource kit there will now be a menu item titled “CMD Promt Here” in the Right-Click menu of a folder.

Command Here

 Enjoy,

Tom Krueger

Another Blog, Huh

Posted September 6, 2007 by Tom Krueger
Categories: Entrepreneur, Software Development

First Post by Tom Krueger 

I have been thinking for a while now about starting a blog but have been concerned about writing the very first post.  I really didn’t know what to say.  I have been interested in writing a blog and sharing my exeriences for one, to have a journal of what I have been doing and second, to hopefully help others as so many other blog writers have helped me. 

This blog will mostly consist of topics related to my two professional passions which are Software Development and Entrepreneurship.  I have been working at both for a while now.  Started out working for a consulting company as programmer and quickly moved into a lead developer position in corporate IT taking on the role of applications architect.  After noticing myself getting a bit comfortable I decided it was time to spread my wings as an entrepreneur and start a company.  The goal of starting the company at that time really was to learn and get exposure to other aspects of business without actually changing careers.  So I chose the path with the least risk and started a software consulting company.  At the same time I picked up and moved to the Seattle area.  I wanted to get out and see some place different; get exposure to new things and new people.  Initially I chose Seattle because of the water, mountains, and technology.  I grew up sail boat racing, I love to down hill ski, and technology is just so darn interesting.  Now it is about 5 years later and I am still consulting and have learned a lot.  Today my biggest struggle is that I am still “working in the business” instead of “working on the business”.  I also continue to have a passion to start another company.  I come up with ideas almost daily so it is getting time for me to start taking action on these ideas.  Many times I’m thinking about something and then a few weeks later I find the idea written up in Business 2.0 magazine which to a degree at least validates the idea for me.  I wish I could find two other people to partner with that were as passionate and eager as me, but of course having different skill sets.  I truly believe with the right people we could crank projects out and deliver them to market quickly. 

Thank you for taking the time to check this out.  I hope you check in from time to time and please drop me a note good or bad through the commets.

Have a wonderful day,

Tom Krueger