Nov 24, 2009

What Was, Has Never Been: Global Warming

So, most of you may have not have heard on TV...or pretty much any other major news outlet that the cats out of the bag.  A hacker was able to break in to the servers at University of East Anglia's Climate Research Unit.  To say the least, what has been revealed is pretty shocking.  Emails reveal deletion of data meant to be kept for FOIA records, conspiring to manipulate data with other scientist, attempts to hide published climate phenomena that contradicts global warming theory, and even moving to prevent scientist that disagree on the causes of Global War-err...I mean "Climate Change".  So here is a few articles with a rundown of all that is happening:

Climategate: the final nail in the coffin of 'Anthropogenic Global Warming'?

Hiding evidence of global cooling

CRU Hackery Links

CBS: East Anglia CRU covered up bad data, computer modeling

UPDATE:
Remember that EPA report that the left howled over the Bush administration "suppressing", and cheered Obama for putting science back in its rightful place by releasing it? CBS reminds us that the EPA "relies on most heavily" on this very same corrupt data in formulating its conclusion.

Nov 9, 2009

Generic Client for WCF


While working on WCF i got frustrated working with the proxy auto-generated by VS2008.  While I loved creating the client channels using a ChannelFactory, i really got tired of writing:

ICommunicationObject
c = Client as ICommunicationObject;
if (c.State == CommunicationState.Faulted)
c.Abort();
else if (c.State != CommunicationState.Closed)
c.Close(); 


after every remoting call.  I searched for ever trying to find an easy way to close up the channel gracefully,
and nothing really stood out.  I really love the using statement pattern as I dont have to call Close(), but if the channel is in a faulted state you get an exception thrown.  I resorted to writing this generic class which isnt exactly pretty, but it gets the job done.



public class RemotingClient:IDisposable
{
public RemotingClient(ChannelFactory factory)
{
Client = factory.CreateChannel();

ICommunicationObject c = Client as ICommunicationObject;

if(null ==c)
throw new ArgumentException(typeof(T).GetType().ToString()
"Can not be used as an ICommunicationObject");

c.Open();
}


public T Client
{ getset; }


#region

//IDisposable Members


public void
Dispose()

{
ICommunicationObject c = Client as ICommunicationObject;

if(c.State == CommunicationState.Faulted)
c.Abort();
else if (c.State != CommunicationState.Closed)
c.Close();


}
#endregion

}
Now I can use my client in a fashion such as:


using(RemotingClient c = new RemotingClient(_channelfactory))
{

c.Client.SomeMethod();
}
and everything takes care of itself.  But for some reason having a class inherit from IDisposable just to take care of the channel doesnt feel right.  If there are any suggestions for a cleaner way I would love to hear it.