Wednesday, June 29, 2011

"You do not have sufficient privilege to access iis web sites on your machine."

While upgrading a solution from VS2005 to VS2010 in XP I got this error:
"You do not have sufficient privilege to access iis web sites on your machine." which was puzzling since I thought I had enough privileges to access iis web sites.
The "solution" to the problem was to execute this command:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ga aa\fincher
which satisfied IIS and the upgrade worked great, well, after I went to IIS, right-clicked on the web site, selected "Properties/ASP.Net" and set the "ASP.NET version" to 4.0.

Austin Java Users Group: Google's GWT and Google App Engine

pic
Daniel Guemeur gave a talk to 70 people at last night's Java User's Group. Pizza was provided from Das Keyboard, which was invented by Daniel. (I've used a Das Keyboard for the last few years and love it).
Google Web Toolkit translates Java code to JavaScript so it can run natively in browsers. The advantage is that you can program in a friendlier language and environment than in javascript - debugging with 'Alert's is not much fun.
With Google App Engine (GAE) you can take applications written in Java, Python, or Go and immediately deploy to Google's cloud servers without the hassle of managing and configuring servers.
Interestingly, Daniel said he was moving one of his applications, app.typrx.com, to GWT and GAE from Ruby on Rails. Daniel thought RoR is good for smaller deployments, but that large enterprise software should be done in something like Java on a robust platform. If you have the staff and machines, you can deploy to your own servers in a traditional way, or you can just use GAE. He estimated that RoR development to be three times faster than Java, but that in the end Java is easier to maintain and scale.
An audience member commented that GAE has been a disappointment to some for its lack of robustness. Daniel agreed that its a problem, but that the advantages still outweighed the downtime.
Gerald Cantor talked in the Technotizer time about the CamelOne conference.

Thursday, May 26, 2011

Free Programatic Interface to Excel in C# - EPPlus

Needing a way to programatically create Excel spreadsheets, I found EPPlus and it works great. It took about 10 minutes to create my first multi-workbook excel file.
You can download it at epplus.codeplex.com.
My toy code:
private static void WriteExcelBrandsList(BrandAndCodeRepository brandsRepository, Choice choice)
{
  using (ExcelPackage pck = new ExcelPackage()) {
    //Create the worksheet for each list
    foreach (var listName in brandsRepository.GetLists())
    {
      ExcelWorksheet ws = pck.Workbook.Worksheets.Add(listName);
      ws.Cells["A1"].Value = "Brand";
      ws.Cells["B1"].Value = "Fieldwork";
      var brandAndCodes = brandsRepository.GetList(listName);
      int i = 2;
      foreach (var brandAndCode in brandAndCodes)
      {
          ws.Cells["A" + i].Value = brandAndCode.BrandId;
          ws.Cells["B" + i].Value = "2011-01";
          i++;
      }
    }
    string fileName = string.Format("C:\\BrandLists_{0}_{1}.xlsx", choice.Category, choice.Locale);
    Console.Out.WriteLine("writing to fileName = {0}", fileName);
    pck.SaveAs(new FileInfo(fileName));
  }
}

Wednesday, May 25, 2011

Austin on Rails, May 24, 2011

I drop in on the Austin on Rails community occasionally to get a taste of what's coming to .Net in a few years. Eighty people crammed into a stuffy room to catch the latest in Rails technology.
Matt Thompson gave an overview of CoffeeScript, a semantically more pleasant version of JavaScript that gets translated into real JavaScript.
Adam Michela, aka soopa, presented Sass, Syntactically Awesome Style Sheets, a layer of abstraction above css which get translated into real css files.
The pairing of the technologies was a nice touch by Damon Clinkscales since both will be in the next version of Rails and both are essentially the same thing - a more human language that gets translated down to a tried and true web component.

Tuesday, May 03, 2011

Agile Austin May 3, 2011 - Steven “Doc” List: The Agile Lego Game

Steven "Doc" List of ThoughtWorks led the Agile group in a fun game of learning agile principles by playing with Legos. One member of each team volunteered to be the "customer", our team was fortunate enough to have Scott Killen. The customer provided each team with a set of user stories like 'your animal should have wings'. We walked through three iterations of estimating, planning, building, and retrospection. The game was a fun way to learn Agile and get to know other members better.











C#: Does a Close() automatically call a Flush()

The following C# code always looked a little clunky to me, because a Close() should probably perform a flush as well. I quickly Googled around and my suspicions were confirmed that the Close() method would automatically do a Flush().
Response.Write(qdbXml);
Response.Flush();
Response.Close();
So while cleaning up some other code I removed the Flush() call. Then everything stopped working. I thought it was the other changes I made at first. Chrome gave this helpful message:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
I restored the Flush() and everything worked great again. The Response object above is a System.Web.Mvc.Controller.Response object which doesn't necessarily work like some other stream objects and needs flushing before closing.
TIL not all stream objects behave alike and I can get in trouble by assuming hastily gathered Googled results apply to me.

Friday, April 22, 2011

SQL Server: Joining on NULLs

Today I learned you can't join tables on NULLs because SQL Server deems a NULL to be an ambiguous quantity so two NULLs are not the same NULL. You can force SQL Server to do the join by doing something like this
... colors c JOIN points p ON (c.color = p.color OR (c.color IS NULL AND p.color IS NULL))
This example assumes only one team will have a NULL color.
CREATE TABLE colors (
  team      varchar(16) NOT NULL,
  color     varchar(32) NULL,
)
CREATE TABLE points (
  color     varchar(32) NULL,
  points    int
)

INSERT INTO colors VALUES ('lobsters','red')
INSERT INTO colors VALUES ('swans','white')
INSERT INTO colors VALUES ('jellyfish',NULL)

INSERT INTO points VALUES ('red',100)
INSERT INTO points VALUES ('white',90)
INSERT INTO points VALUES (NULL,80)
SELECT * FROM colors c JOIN points p ON c.color = p.color
-- returns:
--lobsters         red                              red                              100
--swans            white                            white                            90
SELECT * FROM colors c JOIN points p ON (c.color = p.color OR (c.color IS NULL AND p.color IS NULL))
-- returns:
--lobsters         red                              red                              100
--swans            white                            white                            90
--jellyfish        NULL                             NULL                             80