Friday, April 16, 2010

Debugging custom actions in a Visual Studio 2008 installer

It's simple. Just add the following:

public override void Install(IDictionary stateSaver)
{
Debugger.Break();
...

In order for this to work, I also had to (obviously) build the installer in Debug mode and make sure that Debugger.Break was the first statement in Install(...). This article was really helpful http://harriyott.com/2007/02/debugging-custom-actions-in-visual.aspx

Saturday, April 3, 2010

Hello World

I migrated my blog from my own domain to blogger.com. Transferring the data from my old domain (rortizma.net, which used DNN) was kind of a pain but it's done. Also, blogging using my old domain was too difficult, since I had to do maintenance on the website really often. Using blogger.com should be easier since Google takes care of the back-end.

Thursday, December 17, 2009

Session state can only be used when enableSessionState is set to true

I received this strange error out of the blue. My first guess was that there was something wrong with Visual Studio, so closing it and rebooting my machine worked. I was pretty sure this would work because my code changes were minimal (not enough to cause any errors).

Monday, October 12, 2009

Cross domain HTTP Request using JavaScript

My first choice was to use JQuery. You can use jQuery.ajax with dataType="jsonp". However, this won't work unless the servers supports jsonp (http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/). Cross domain HTTP requests are a really interesting topic.

After several tries, I decided to do this using ASP.NET (in the code-behind page):

Uri uri = new Uri("http://192.168.0.1/default/query");

if (uri.Scheme == Uri.UriSchemeHttp)

{

WebRequest request = HttpWebRequest.Create(uri);

request.Method = WebRequestMethods.Http.Get;

WebResponse response = request.GetResponse();

StreamReader reader = new StreamReader(response.GetResponseStream());

return reader.ReadToEnd();

}

Saturday, October 3, 2009

Filtering columns with NULL values in ADO.NET

In order to return columns with null values from a DataTable, use this expression:

"Isnull(Col1,'Null Column') = 'Null Column'"

If you need more information about filtering data, check out http://www.akadia.com/services/dotnet_filter_sort.html

Tuesday, September 22, 2009

Converting a string into an Enum

To convert a string into an Enum:

myClass.GeomType = (Display.GeomType)Enum.Parse(typeof(Display.GeomType), myGeomType.ToString(), true);

To convert an Enum into a string:

string test = myClass.GeomType.ToString();

Sunday, September 20, 2009

Google Analytics/Google Webmaster Tools

A while ago I started using Google Analytics. It was really easy to set up, and it gives you useful information, like:

1) site usage statistics
2) visitor profile information (like location)
3) browser used
4) Navigation analysis

OK, I agree this is information that you could retrieve with other commercial software. However, Google Analytics provides you with easy-to-read reports, and it's free (of course, you should be willing to share the collected information with Google). You can even build custom reports!!

In fact, I just read something about Google Webmaster Tools. I'll give it a try!