Apache mod_proxy alternative using IIS

Apache and mod_proxy are an excellen choice if you want to setup a proxy or reverse proxy server.  As an alternative, if you already are running IIS7 or higher, you can configure IIS to proxy requests without the need to install/maintain an Apache instance.

You can even proxy requests to other technology stacks, for example if you are runnign rails or Java, etc., you can proxy requests to webspere and other app servers and have all requests go through the same server/url/IIS instance.

The following link provides an excellent overview of how to configure IIS to proxy requests.

http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing 

Query to find foreign keys in an Oracle database

The following query will return all of the columns for a table and will include an indicator if the column is a foreign key:

 

select utc.*,
case when exists(
select 1 
from all_cons_columns ucc
join all_constraints uc on ucc.constraint_name = uc.constraint_name
where uc.constraint_type = 'R'
and uc.table_name = utc.table_name
and ucc.column_name = utc.column_name)
then 1
else 0
end IsForeign
from all_tab_columns utc where utc.table_name = 'YOURTABLE' and utc.owner = 'THEOWNER'

 

Oracle Data Provider for .NET and Disposing of DbCommand and Parameters

There are quite a few examples of using Microsoft's Enterprise Library Data Access Block that does not illustrate calling Dispose on the DbCommand and Parameters collection.  When working with ODP.NET it is a recommended best practice to explicitly dispose of both. For the DBCommand, a "using" block is a good choice as once out of scope, Dispose will always be called.

In terms of parameters, the following example can be used to ensure they are cleaned up:

foreach (OracleParameter p in cmd.Parameters)
{
if (p.Value is IDisposable)
{
((IDisposable)(p.Value)).Dispose();
}
((IDisposable)p).Dispose();
}

 

Oracle Data Provider for .NET and Disposing of DbCommand and Parameters

There are quite a few examples of using Microsoft's Enterprise Library Data Access Block that does not illustrate calling Dispose on the DbCommand and Parameters collection.  When working with ODP.NET it is a recommended best practice to explicitly dispose of both. For the DBCommand, a "using" block is a good choice as once out of scope, Dispose will always be called.

In terms of parameters, the following example can be used to ensure they are cleaned up:

foreach (OracleParameter p in cmd.Parameters)
{
if (p.Value is IDisposable)
{
((IDisposable)(p.Value)).Dispose();
}
((IDisposable)p).Dispose();
}

 

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

If you run bundle and receive the message: 
 
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
server certificate B: certificate verify failed
 
You might need to update your gem version - issue the following: 
$ gem -v

if less than 1.8.24, update using:

$ gem update --system
 

The 'json' native gem requires installed build tools

If you are trying to run bundle install or rake version:write ib windows and receive the message The 'json' native gem requires installed build tools or 

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools 

you can resolve by doing the following:

Visit  

http://rubyinstaller.org/downloads

and download the development kit (make sure you download the link for the development kit, not ruby,etc) 

Once downloaded, follow the instructions on:

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit 

Load dropdown with .ajax then set the selected value with jQuery

Recently I encountered an issue when trying to set the selected value of a dropdown list.  I was using the jQuery .ajax method to populate the select list and this was working, but when I tried to set the selected value using jQuery, I was not able to.  I should have realized that .ajax makes a async call by defualt and there is no garuntee the list will be populated when you try to set the selected value.

There are a couple of solutions.  You can set the selected value in the success event handler or you can set async to falst in the .ajax method:

async: false,

jQuery checked attr jQuery 1.5 to 1.6.4

If you have jQuery code that reads the .attr("checked") and you upgrade from 1.5 to 1.6.4, you should read this:

http://ejohn.org/blog/jquery-16-and-attr/

In summary, if you were relying on .attr("checked") returning true or false, the behavior has changed with 1.6 as it now returns "checked" or "". The problem being that JavaScript will equate both "checked" and "" as true in an if statement.

Visual Studio 2010 SP1 IIS will not start

If you install Visual Studio 2010 SP1 and then you find that IIS will not start, you may have a port conflict issue.  SP1 includes a new service, the Web Deployment Agent Service.  This new service runs on port 80, the same default port that IIS uses for HTTP traffic.  If the Web Deployment Agent Service is running, IIS will not start if you are using port 80 in IIS.  On option is to modify the web deployment agent service.  For me, I stopped and disabled since I do not plan to use.  You may be able to change the port is uses by default.  Additional info can be found at the link below

http://superuser.com/questions/282519/change-the-port-of-iis-7-5-express

Debug WCF service IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports

If you want to debug a WCF service you may encounter the following error in Visual Studio:

IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.. ---> System.InvalidOperationException: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used

This can occur if the virtual directory hosting the service in IIS has both the Intergrated Windows Authentication and Anonymous authentication schemes selected.  In order to get around this so that you can debug your service, you can do the following:

  1. In IIS, uncheck the Annonymous scheme
  2. In IIS, leave Integrated Windows Authentication checked - this is required to run the VS Debugger
  3. Start the debugger from VS
  4. Before you make a request to your service, go back into IIS and check the Annonymous scheme
  5. Make a request to your service and your break point will be hit