Google Profiles

by rsutton 28. April 2009 01:53

I just learned about Google Profiles.  It is an interesting service that allows you to create a profile that will show up on the first page of a Google search for your name.  If you search for Randall Sutton you will see my profile listed at the bottom of the page.  So give it a shot and set on up yourself.

Tags:

Misc

Crystal Report bound to a Typed DataSet throws error when adding a column from a related table.

by rsutton 15. April 2009 07:37

Here is a question that I posted on StackOverflow today.  Although I haven’t received an answer yet I was able to figure it out by myself so I thought I would share it.

 

QUESTION:

I am using Crystal Reports 2008 to design reports and the Crystal Reports 2008 runtime to execute them in a web application. I have created a simple typed DataSet and that has two tables TestTable1 and TestTable2. Each has a few columns like Id, Text1, and Text2. I created a test report which uses this Typed DataSet as it's DataSource. If I add the columns from just one of the tables TestTable1 or TestTable2 the report is easily executed with this code.

 

        report = new ReportDocument();
        report.Load(Server.MapPath("bin/testreport.rpt"));

        var ds = GetData();

        report.SetDataSource(ds);

        CrystalReportViewer1.ReportSource = report;
        CrystalReportViewer1.RefreshReport();

 

The problem is that when I add a column from the other table I get this message.

"Error in File C:\Windows\TEMP\testreport {94AF2363-CA61-4944-B63E-C0E6E0391C9A}.rpt: The request could not be submitted for background processing."

If I only have columns from one table it works just fine, but adding any columns from the second table gives this error.

Any ideas? I tried both with and without relations in the DataSet. I also tried a untyped DataSet.

 

SOLUTION:

Install Crystal Reports 2008 SP0.

That is no mistake SP0…that’s right zero.  Go figure.  The tricky part of course is being able to find it.  Here is the link.  Once you get there you just select the options below and note that it is on the second page.

cc

Tags:

Simple Amazon Web Services (AWS) Example in Python

by rsutton 8. April 2009 04:18

Here is a simple example of how to create a request for Amazon Web Services using python.  Mainly I want to show how to generate and sign a request.  Once you get this down the rest is fairly straight forward.

NOTE: This example just lists your queues in the Amazon Simple Queue Service.

    1 
    2 import urllib
    3 import hmac
    4 import hashlib
    5 import base64
    6 from datetime import datetime
    7 
    8 AWS_ID = '1234567890'
    9 AWS_KEY = '1234567890+1234567890+1234567890'
   10 
   11 def generate_timestamp():
   12     ret = datetime.utcnow()
   13     return ret.isoformat() + 'Z'
   14 
   15 def generate_signature(key,str):
   16     return base64.encodestring(hmac.new(key,str,hashlib.sha1).digest()).strip()
   17 
   18 ts = generate_timestamp()
   19 
   20 request_str = 'ActionListQueuesAWSAccessKeyId'
   21 request_str += AWS_ID
   22 request_str += 'SignatureVersion1Timestamp'
   23 request_str += ts
   24 request_str += 'Version2008-01-01'
   25 
   26 request_sig = generate_signature(AWS_KEY,request_str)
   27 
   28 request_url = urllib.urlencode({
   29     'SignatureVersion':'1',
   30     'Action':'ListQueues',
   31     'Version':'2008-01-01',
   32     'Timestamp':ts,
   33     'AWSAccessKeyId':AWS_ID,
   34     'Signature':request_sig
   35     })
   36 
   37 print 'Request Data'
   38 print
   39 print urllib.urlopen('http://queue.amazonaws.com?' + request_url).read()
   40 

That’s it.  I hope this make using AWS easier.

Tags:

Development

NHibernate Automatically Configure Oracle and Sql Server Based on Connection String

by rsutton 7. April 2009 01:17

Here is a nice way to modify your NHibernate configuration to support both Oracle and Sql Server automatically based solely on the connection string.

 

    1 
    2 const string CONNECTION_STRING_NAME = "DbConnectionString";
    3 
    4 var cfg = new Configuration();
    5 cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
    6 cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionStringName, CONNECTION_STRING_NAME);
    7 
    8 if (ConfigurationManager.ConnectionStrings[CONNECTION_STRING_NAME].ProviderName == "System.Data.SqlClient")
    9 {
   10     cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2000Dialect");
   11     cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.SqlClientDriver");
   12 }
   13 else if (ConfigurationManager.ConnectionStrings[CONNECTION_STRING_NAME].ProviderName == "System.Data.OracleClient")
   14 {
   15     cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.Oracle9Dialect");
   16     cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleDataClientDriver");
   17 }
   18 else
   19     throw new Exception("Unsupported database provider specified in database connection string.");

 

This could of course be easily extended to include multiple providers.

Tags:

Development

Powered by BlogEngine.NET 1.4.5.0
Theme by Extensive SEO

Profile

Member of the Church of Jesus Christ of Latter-Day Saints, Developer and IT Professional