My Tool List

Posted January 14, 2012 by Tom Krueger
Categories: Uncategorized

 

Here are a list of tools that I use on a regular basis.

Basics for every computer

  • Chrome (Free) – Best overall web browser.  Simple, clean, fast.  I also use Google Sync to keep my bookmarks in sync across all computers.
  • Evernote (Free)– Lets me take notes, make lists, etc and syncs with everything.  I have liked OneNote but since it doesn’t sync with my IPhone and IPad(at least as far as I know) I have choosen Evernote. 
  • Notepad++ (Free) – tabbed notepads do I have to say more.  I had tried Notepad2 but settled on Notepad++.
  • Beyond Compare ($30/$50)  – Simply the best file comparison tool available.  In my opinion this is my most essential tool.  You only need to go up to the pro version for use with source control, pro gives you 3 way merging which I love.  Beyond compare integrates with most source control providers, here how.
  • PicPick (Free for Personal) – Screen Capture Tool.  This is just the one that I’ve been using lately.  I also use the Snipping Tool that comes with Windows 7.
  • Virtual Clone Drive (Free) – I use it for mounting ISO’s.
  • 7-Zip (Free) – Zip and Unzip pretty much anything.
  • Microsoft Office ($$$) – I really would like to find cheaper tools but nothing compares to Word, Excel, and Visio. If you have good recommendations on other tools please let me know.  I wish Google Docs was better.  That would then be my choice.

Development

  • Visual Studio 2010 ($$$) – Truly a pleasure to work with Visual Studio.  I do wish Microsoft would focus soley on performance of what is there instead of adding more features.  It is not always bad, but sometimes performance is horrible.
  • Visual Studio Extensions
    • Solution Explorer Tools – Collapse folders in solution explorer and sync to the current document.
    • CodeMaid – Cleans up code.  Auto formats the document, removes extra spaces and lines etc.  No human should have to spend the time to do this.
    • PowerCommands for Visual Studio 2010
    • Productivity Power Tools
  • SQL Search 1.1 (Free) – Search Sql Server Schema and Stored Procs.  You cannot live without this.
  • RedGate’s Sql Tools ($$$) – Sql Data Compare and Sql Schema Compare are simply the best.  I wish they were cheaper for personal use.
  • .NET Reflector ($35 – $95) – Need to find a proper replacement since this is no longer free.
  • Team Foundation Server – My overall favorite for source repository and ALM.
  • Fog Creek’s FogBugz – Issue management and bug tracking software and more.
  • Fog Creek’s Kiln – Online Sophisticated Source Repository.  When you don’t want to manage your own TFS server this has been my next choice.

Misc

  • VMWare Player (Free) – I am currently using VMWare Player to create virtual environments I really would like to upgrade to the workstation version so that I could more easily save snapshot but it is two pricey at this time.
  • Display Fusion (Free or $35 for Pro) – Managing multiple monitors.  The two important features for me are that it adds a task bar to each screen and allows you to easily move a window to another screen through a single click or hot key.
  • Acronis Disk Director (49.99) – There have been a handful of times I have a had to mess with my hard disk.  Windows has great built in features but when they don’t cut it Disk Director has come to the rescue.

Business

  • FreshBooks – I’m trying out FreshBooks now.  So far I like how simple it is.  I can also updated it with an IPhone app.

Setting Up Android Dev Environment on Windows 7

Posted January 13, 2012 by Tom Krueger
Categories: Android

It is about time I take a look at the Android Development environment.  Here are the steps I took to set it up.  Most of this is documented at http://developer.android.com/sdk/installing.html.

  1. Install JDK
    File: jdk-7u2-windows-x64.exe from http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html
    Installed To: C:\Program Files\Java\jre7\
  2. Install Eclipse Classic
    File: eclipse-SDK-3.7.1-win32-x86_64.zip
    Unzipped and ran Eclipse.exe
  3. Install Android SDK Starter
    File: installer_r16-windows.exe from http://developer.android.com/sdk/index.html
    Installed To: C:\Program Files (x86)\Android\android-sdk
  4. Install ADT Plugin for Eclipse
    Followed instructions at http://developer.android.com/sdk/eclipse-adt.html#installing

    Note: Restarts Eclipse

  5. Configure ADT Plugin for Eclipse
    You need to choose one Android Platform to install.  I choose the latest to allow it to finish setting up.

Overall the install process was fairly easy, however, it would have have been better if someone would create a manager to walk through the setup and click install instead of having to download, wait, install, wait, repeat for next step.  The fun part was being able to walk through the “Hello, Android” tutorial pretty quickly and run it through the emulator.  The cool part is that it is very much like WPF XAML, well at least at a first glance at least.

Problems:

1) When creating a device in the AVDManager for some reason it could not create directories.  I ran the AVDManager with administrator rights and it worked.

2) The SDK Manager may not download everything as it says.  I have had it happen twice when something that was checked didn’t get downloaded.  If you find unexpected errors occurring go back to the SDK Manager and make sure it says installed. 

I will update this post as I play around more with general setup info.

Sending email through GMail using SmtpClient

Posted November 13, 2010 by Tom Krueger
Categories: .NET

Ok so I just signed up for Google Apps primarily because I wanted to get off of GoDaddy’s email offering.  I chose Google Apps Standard because 1) it is free and 2) because Google is awesome.  Oh btw Microsoft I did try to get setup on Office Live Small Business, however, you required me to host my web site there in order to have email.  I use Azure for hosting so it sure would be nice if you could give us Small Business Azure users a hook up on Office Live Small Business for hosting email without a web site.  Anyway  I’m not made, I’m cool with Google.

So down to the code that works to send email from Google.

MailMessage message = new MailMessage();
message.From = new MailAddress(you@yourDomain.xxx);
message.To.Add("yourFriend@someDomain.com");
message.Subject = "TEST Message";
message.IsBodyHtml = false;  // Could be true to.
message.Body = "TEST";

SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.Credentials = new NetworkCredential("you@yourDomain.xxx", "your password");
smtp.EnableSsl = true;   
smtp.Port = 587;

smtp.Send(message);

Potential Issues

Error Message
“System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at “

Resolution
This could be a few different things.  First make sure that your user name and password are correct.  The second major thing and what I got burned on was setting the property “UseDefaultCredentials”.  I explicitly set this property to false after I set the Credentials property.  Well that is bad because, the credentials get set to null at that time.  So make sure at the time you call Send that the credentials are set.

Error Message
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first.”

Resolution
One reason why you might get this message is that you have not enabled SSL, so to resolve set EnableSsl = true.

Preparing for Startup Weekend with latest .NET coolness.

Posted November 10, 2010 by Tom Krueger
Categories: .NET, ASP.NET MVC, Software Development, Uncategorized

I’m heading to startup weekend Chicago on Friday and have setup my machine with the latest coolness from Microsoft.  They say the Ruby is King but I’m planning to show off .NET and gain some respect for us .NET developers.

My setup

  • .NET 4.0
  • ASP.NET MVC 3 Beta
  • Entity Framework 4 Code First CTP
  • SQL Server 2008 Express
  • SQL Server Compact 4.0 CTP

I started writing a small app earlier this week and all of the CTP’s and Betas seem to work well.  I am most excited about the EF 4.0 Code First CTP.  This basically takes database work out of the picture making it great for fast prototyping.  I will probably stick with SQL Server 2008 Express over the compact version just because I know that it is stable.  I also will likely use jQuery UI themes to make the site look decent without much work.  Although it would be great to get paired up with a designer.

Developer Environment Setup Instructions

Install Visual Web Developer 2010 Express

Download from: http://www.microsoft.com/express/downloads/
I assume that .NET 4.0 will get installed at the same time.  If not, you may need to download it separately.  I am personally running the Premium version but I wanted to include this incase someone wanted to get started for free.

Install ASP.NET MVC 3 Beta

Unfortunately you will need to install the ASP.NET MVC 3 Preview 1 first.  It can be downloaded from: http://www.microsoft.com/downloads/en/details.aspx?familyid=CB42F741-8FB1-4F43-A5FA-812096F8D1E8&displaylang=en

Files to install:
AspNetMVC3Setup.exe  (Preview 1)

Download the Beta from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0abac7a3-b302-4644-bd43-febf300b2c51&displaylang=en

Files to install:
AspNetWebPages.msi (Beta)
AspNetMVC3Setup.exe (Beta)

Microsoft ADO.NET Entity Framework Feature Community Technology Preview 4

This is used for code first development and will be the most valuable feature in rapid prototyping.  With this we won’t need to mess with configuration files or setting up a database first.
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4e094902-aeff-4ee2-a12d-5881d4b0dd3e&displaylang=en

Microsoft SQL Server Compact 4.0 Community Technology Preview for Windows Desktop

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0D2357EA-324F-46FD-88FC-7364C80E4FDB&displaylang=en

Files to install:
SSCERuntime_x86-ENU.exe

What follows is still a work in progress but I wanted to get the post out before the weekend.  I’ll update as time permits.

Create Project

  1. Open Visual Studio
  2. Create New Project
  3. Select Web
  4. Select ASP.NET MVC 3 Web Application
  5. Add Reference to System.Data.Entity.CTP located at “\Program Files\Microsoft ADO.NET Entity Framework Feature CTP4\Binaries”

Code First Walk through by Scott Gu
http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

NOTE: Razor Syntax Highlighting and Intellisense is missing from the Beta.  Sucks.

Even though the new syntax looks great, I’m probably going to stick with the what I’m use to for this weekend.  No Intellisense is a performance killer especially when you are learning the syntax.

Add Razor Highlighting

Option 1:   You can set the cshtml extension to use the Html Editor so that you at least get html highlighting.

  1. Go to Tools | Options | Text Editor | File Extension
  2. Enter cshtml
  3. Select Html Editor
  4. Click Add

    (You may need to close and reopen your cshtml for highlighting to start)

Option 2: Install the Razor Syntax Highlighter.  I didn’t try this yet because it is dependant on Web Matrix.

http://visualstudiogallery.msdn.microsoft.com/en-us/8dc77b9c-7c83-4392-9c46-fd15f3927a2e?SRC=Home

Free eBooks That Interest Me

Posted November 9, 2010 by Tom Krueger
Categories: Uncategorized

Tags:

I’m starting this post as a list of free eBooks that interest me.  I frequently see books that would interest me but I just don’t have the time to read everything and then I loose track of it so to resolve that problem this post is born.  I’ll continue to update this post as I discover new ones.  Please feel free to add your favorite books to the comments.

The List

Programming Windows Phone 7 – by Charles Petzold

Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4

Writing High Performance SQL Code

Add minutes to date in JavaScript

Posted November 3, 2010 by Tom Krueger
Categories: JavaScript, Snippets

Tags:

 

Here is a quick snippet to add minutes to a date in JavaScript.  A similar technique can be used for hours, seconds, etc.

var minutesToAdd = 10;

var someDate = new Date();
someDate.setMinutes(someDate.getMinutes() + minutesToAdd);

Keeping the original date

var someDate = new Date();
var adjustedDate = new Date(someDate);
adjustedDate.setMinutes(someDate.getMinutes() + minutesToAdd);

How to Stop a query from Auto Committing in Microsoft SQL Server Management Studio.

Posted August 23, 2010 by Tom Krueger
Categories: SQL Server

By default Microsoft SQL Server Management Studio Query (Query Analyzer) auto commits leaving no option to rollback.  I had been very use to this and preferred it this way, however, recently I had been working in an environment with different tools where explicit commit was the preferred way and so now I want the flexibility of both in SQL Server as well.

One option is to turn on implicit transactions at the beginning of your query using  “set implicit_transactions on”.  When this is on, you will still see all of the updated or inserted row counts when executing your query, but you will have the option to rollback or commit.

Another way is to turn on implicit transactions by default within SQL Server Management Studio.

  1. Tools –> Options
  2. Expand Query Execution –> SQL Server
  3. Select ANSI
  4. Either Check SET IMPLICIT_TRANSACTIONS or SET ANSI_DEFAULTS

JUST BECAREFUL.  Don’t leave a transaction open because it may end up blocking other users.  Always make sure to commit or rollback.

MSDN Ref – http://msdn.microsoft.com/en-us/library/ms187807.aspx

WPF Application Issue Upgrading 2008 to 2010.

Posted July 30, 2010 by Tom Krueger
Categories: Visual Studio, WPF

Just ran into another upgrade issue moving to Visual Studio 2010.  This time it was with a WPF Application.  When I went to open the properties window for the application in Visual Studio 2010 it gave me the error:

“An error occurred trying to load the project properties window.  Close the window and try again.  Unspecified error (Exception from HRESULT: 0×80004005 (E_FAIL))”

Ugh.

I did a bit of searching to find the answer but then remembered that I had a some luck the other day in a similar situation with Windows Azure that I was able to resolve by comparing a new project file with the one I had.  What I found was that the configuration property groups were missing.

Solution

Copy the configuration property groups from the new project file to the one that does not work.  You will need to update the configuration setting if you have changed them from the defaults.  If you did take a backup that would be the best place to get your setting values from, however, consider that these groups may have gone missing in the first place due to some invalid setting value.

Here is an example of the standard configuration property groups for both Debug and Release on x86.

<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Debug|x86′ ">
  <PlatformTarget>x86</PlatformTarget>
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <Optimize>false</Optimize>
  <OutputPath>bin\Debug\</OutputPath>
  <DefineConstants>DEBUG;TRACE</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Release|x86′ ">
  <PlatformTarget>x86</PlatformTarget>
  <DebugType>pdbonly</DebugType>
  <Optimize>true</Optimize>
  <OutputPath>bin\Release\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
</PropertyGroup>

Hope this will save you some hair!

Azure Deployment Issue after upgrading to Visual Studio 2010 and .NET 4.0

Posted July 27, 2010 by Tom Krueger
Categories: Windows Azure

If you have recently upgraded your Web Role project from Visual Studio 2008 to Visual Studio 2010 you may end up experiencing a problem getting your Web Role to startup when you deploy it to Windows Azure.

There are a variety of reasons that your Web Role will not startup properly, however, if you are in this upgrade scenario check the bin of your Web Role project for the msshrtmi.dll.  If it exists then you are in luck, because that is likely your issue.  For some reason when you upgrade, this file ends up in your bin and therefore gets deployed to Windows Azure.  However, if you are developing on a x86 version of Windows (vs x64) then the dll that is in your bin will be the x86 version.  Windows Azure is x64 and thus when Azure attempts to startup your Web Role an error such as the following occurs.

Exception message: Could not load file or assembly ‘msshrtmi’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Solution
It took a bit of playing around and comparing of the project files of a brand new Web Role to an upgraded one.

I was told that if I delete all of the bin directories in all of my projects then the file will not get copied.  I personally found this to be false, but it may be something that you will want to try.  After quite a bit of playing around I found that if I remove the <PlatformTarget> element from the configuration property group in the project file of my web project then the msshrtmi.dll file is not copied to the bin.  Hurray! 

Steps

  1. Open the web site project file using Notepad.
  2. Remove the PlatformTarget element from all configuration property groups.

Example Configuration Property Group
<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Debug|AnyCPU’ ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <Optimize>false</Optimize>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

If you still are unable to get your Web Role to start I believe you will need to log a case with “Report Live Site Issues” for Windows Azure from the Windows Azure support page.  I currently do not know how to view the log files that would provide you the startup errors, which is why you will need to log a case.  If anyone knows how to get the startup errors please post a comment or email me.

Right-clicking a file crashes Windows Explorer

Posted March 25, 2010 by Tom Krueger
Categories: Windows

Tags:

 

Recently I had encountered an incredibly annoying problem in Windows Explorer where whenever I right-clicked on a file Windows Explorer would crash.  I tried uninstalling the most recent software that I installed figuring that something may have been put in the Context menu, but that didn’t solve it.  After a bit of searching I found this article “Troubleshooting Windows Errors” which addressed the issue and told me about a handy program called ShellExView that can be used to enable and disable context menu items.

You can read the troubleshooting article listed above for more details, but here is the gist:

1) Download, UnZip, and Run ShellExView

2) Sort By Type and look for those labeled Context Menu.

3) Disable all of the Context Menu Extensions that are NOT provided by Microsoft.  There is a Company column that can be used to identify these.  It is unlikely that Microsoft is the one causing the problem.

4) At this point, you could try right-clicking on a file.  If the problem still exists, you may want to close everything down and then re-open explorer and try again.  I’m not certain when the disabling takes effect.

5) Once you have disabled enough extensions to resolve the issue, start re-enabling the ones you have disabled.  To make them easier to find just sort by the disabled field and start enabling the ones that are disabled.

If you happen to resolve you issue using this information, please post a comment that identifies the software that caused the problem and the version of Windows that you are using.  That information may be useful to others having this problem.

Hope this saves you some hair,

Tom

How To Call a Web Service from Oracle PL/SQL – Part II

Posted February 2, 2010 by Tom Krueger
Categories: Oracle PL/SQL

A while back I posted on how to call a web service from Oracle PL/SQL here, but it was more of a basic starting point.  I had further enhanced the version to be more generic but never posted it.  Sorry.

I’ve written this version in a single declare so you can easily run the example.  When you put it in practice you will want to break it out in to the proper packages and add logging as needed.

declare
   ls_result  clob;
                                                                                --
                                                                                --
   -------------------------------------------------------------------------------
   -- f_callWebService
   --
   -- Helper method to call a web service.
   --
   -- Returns the value returned from the web service method.
   --
   -------------------------------------------------------------------------------
   function f_callWebService (
               as_serviceUrl      in varchar2,
               as_targetNamespace in varchar2,
               as_serviceName     in varchar2,
               as_portName        in varchar2,
               as_wsMethodName    in varchar2,
               as_parmName1       in varchar2, -- TODO: Update to pass an array of name/value pairs.
               as_parmValue1      in varchar2)
   return clob
   is
      cs_soapActionUseKey  constant varchar2(14) := 'SOAPACTION_USE';
      cs_soapActionUseVal  constant varchar2(4)  := 'TRUE';
      cs_soapActionUriKey  constant varchar2(14) := 'SOAPACTION_URI';
      ls_targetNamespace            varchar2(500);
      ls_serviceQname               sys.utl_dbws.qname;
      ls_portQname                  sys.utl_dbws.qname;
      ls_operationQname             sys.utl_dbws.qname;
      ln_service                    sys.utl_dbws.service;
      ln_call                       sys.utl_dbws.call;
      lx_serviceRequest             sys.xmltype;
      lx_serviceResponse            sys.xmltype;
      ls_resultXpath                varchar2(100);
                                                                                --
                                                                                --
      function extractResult(
                  ac_webServiceResponse in xmltype,
                  as_targetNamespace    in varchar2,
                  as_wsMethodName       in varchar2)
      return clob
      is
         lx_result                       sys.xmltype;
      begin
         --
         -- Parse the result from the service response.
         -- Example Xpath: ExecuteResponse/ExecuteResult/child::text()
         --
         ls_resultXpath := as_wsMethodName || 'Response/'
            || as_wsMethodName || 'Result/child::text()';
                                                                                --
         -- Extract return value.
         lx_result := lx_serviceResponse.extract(ls_resultXpath,
            'xmlns="' || as_targetNamespace || '"');
                                                                                --
         if lx_result is not null then
            return lx_result.getClobVal();
         end if;
         return null;
      end extractResult;
   begin
                                                                                --
      if as_serviceUrl is null or trim(as_serviceUrl) is null then
         raise_application_error( -20001,
            'Argument not passed exception. Argument: ''as_serviceUrl''');
      end if;
      --TODO: Validate other parameters.
                                                                                --
      -- Append url separator to end if one does not exist.
      ls_targetNamespace := as_targetNamespace;
      if substr(ls_targetNamespace, length(ls_targetNamespace), 1) != '/' then
         ls_targetNamespace := ls_targetNamespace || '/';
      end if;
      --
      -- Initialize the service components.
      --
      ls_serviceQname := sys.utl_dbws.to_qname(
         name_Space    => ls_targetNamespace,
         name          => as_serviceName);
                                                                                --
      ls_portQname := sys.utl_dbws.to_qname(
         name_Space    => ls_targetNamespace,
         name          => as_portName);
                                                                                --
      ls_operationQname := sys.utl_dbws.to_qname(
         name_Space    => ls_targetNamespace,
         name          => as_wsMethodName);
                                                                                --
      -- Create the service and call objects.
      ln_service := sys.utl_dbws.create_service (
         service_name   => ls_serviceQname);
                                                                                --
      ln_call := sys.utl_dbws.create_call (
         service_handle => ln_service,
         port_name      => ls_portQname,
         operation_name => ls_operationQname);
                                                                                --
      -- Set values on the call object.
      sys.utl_dbws.set_target_endpoint_address(
         call_Handle   => ln_call,
         endpoint      => as_serviceUrl);
                                                                                --
      sys.utl_dbws.set_property(
         call_Handle   => ln_call,
         key           => cs_soapActionUseKey,
         value         => cs_soapActionUseVal);
                                                                                --
      sys.utl_dbws.set_property(
         call_Handle   => ln_call,
         key           => cs_soapActionUriKey,
         value         => ls_targetNamespace
                           || as_wsMethodName);
                                                                                --
      --
      -- Create service request xml.
      --
      lx_serviceRequest := sys.xmltype(
         '<' || as_wsMethodName || ' xmlns="' || ls_targetNamespace || '">'
         ||   '<' || as_parmName1 || '>'
         ||      as_parmValue1
         ||   '</' || as_parmName1 || '>'
         || '</' || as_wsMethodName || '>');
         dbms_output.put_line(lx_serviceRequest.getclobval());
                                                                                --
      --
      -- Call the service.
      --
      begin
         lx_serviceResponse :=
          sys.utl_dbws.invoke(ln_call, lx_serviceRequest);

      exception
         when others then
            -- TODO: Log Error
            dbms_output.put_line(sqlerrm);
            raise;
         end;
                                                                                --
      sys.utl_dbws.release_call (call_handle => ln_call);
      sys.utl_dbws.release_service (service_handle => ln_service);
                                                                                --
      return extractResult(lx_serviceResponse, ls_targetNamespace, as_wsMethodName);
   end f_callWebService;
begin
   ls_result :=
      f_callWebService(
         as_serviceUrl => 'http://interpressfact.net/webservices/getjoke.asmx',
         as_targetNamespace => 'http://interpressfact.net/webservices/',
         as_serviceName => 'getJoke',
         as_portName => '',
         as_wsMethodName => 'getJoke',
         as_parmName1 => 'Category',
         as_parmValue1 => 'Excuses-10');
   dbms_output.put_line(ls_result);
   return;
end;

Disclaimer: This code could very well be improved upon.  Please test it first and please let me know of your improvements.  Thanks!

Run It

I Run the example in Golden6.

  1. Paste the code into a query tab
  2. Open the DBMS.Output window (F10).  This is were the output will be for this example.
  3. Execute Query (F5).

I have noticed that sometimes, the first time I run it, it takes a long time to run (more than a minute).  I assume that this is because the joke web service has not be hit lately and is spinning up, but I’m not certain.  My point is be patient.

Notes

There is currently only a single parameter being passed in because I used it to pass xml to a single parameter web service.

Errors

If the target namespace does not end with a separator ‘/’ the following exception will be raised.  However, you should not have to worry about it because the code sample appends the separator if it is not passed in.

ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://interpressfact.net/webservicesgetJoke.
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest req

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


Follow

Get every new post delivered to your Inbox.