

Here's a pic of Rich, Kayleen, Stephanie, and me waiting to listen to Klementine play. That's a band that's playing at our wedding in October. Oh yeah, I guess I could've mentioned that earlier! Stephanie and I are engaged. Woohoo! Jes, the lead singer, took the photo.
We all rode motorcycles to the bar. Don't worry, I drank a virgin rum & coke (aka a diet coke). Then we got home at midnight, woke up early the next morning and over Saturday and Sunday Steph and I rode 400 miles...yeah...wow. Saturday was blazing hot, about 90 degrees, which no matter how fast you're going is still hot. Sunday was cooler, under 80 degrees and going on the highway produced enough of a breeze for a really comfortable ride.
Then I made the changes I needed to to web.Navigation.Quicklaunch, etc. This all worked fine because of my permissions within SharePoint, but when our test user would go to the site, the page would fail with a message about "The list does not exist.". At the end of the AccessDenied.aspx URL was a GUID. I looked up the guid in the AllLists table in the database and found out which list it was. This was a red herring. There wasn't really a problem getting to the list because I was already accessing the list to populate some information on the page. Anyway, I tried to use SPSecurity.RunWithElevatedPrivileges(..) to make it so the regular user that was being impersonated could make the same navigation changes I was making as a site admin. It didn't work, but thanks to this forum entry I found out what I had to do. Basically, I had to spin up a new instance of the SPWeb and make my changes in that context. Here's what the code looks like:SPWeb web = SPContext.Current.Site.OpenWeb();
SPSecurity.RunWithElevatedPrivileges
(delegate()
{
SPWeb aWeb = (new SPSite(web.Url).AllWebs[web.ID]);
aWeb.AllowUnsafeUpdates = true;
BuildLeftSideNav(aWeb);
});
So, the long story short...this is how you make RunWithElevatedPrivileges work. Also, you don't have to use an anonymous method like I did; you can pass a method name to RunWithElevatedPrivileges as long as it returns void and takes no parameters.
I've become quite fond of the ObjectDataSource control for binding to grids, etc. It's a beautiful thing, the ObjectDataSource control, as long as you're only dealing with one DataTable. If you hook it to a DataSet, it only grabs the first table (d'oh!), and makes a dataview of that. Now my queries may pull back one result set, but may also pull back more for certain reports. So, for a moment I figured I was back to setting the grid's .DataSource property and calling .DataBind()--yuck, thus losing the magical functionality of the ObjectDataSource control...but I found a way around it.
First off, my GridView and ObjectDataSource are now in their own .ascx control. In the report page, I call my query. I for-each through every table in the retured DataSet, dynamically loading the user control and setting a property on it.
DataSet ds = (new Report()).GetData();
foreach(DataTable dt in ds.Tables)
{
controls_reportGrid rptGrid =
(controls_reportGrid)LoadControl(
"controls/reportGrid.ascx");
rptGrid.Table = dt;
phGrids.Controls.Add(rptGrid);
}
I created a Table property in the user control hoping to set the ObjectDataSource to a method that returns that table. Oops. The ObjectDataSource only looks in the App_Code folder (or bin folder) for objects. Now, to get around that, I've written the most obscure class that appears to do nothing useful, but it really does. It lives in the App_Code folder.
Here it is...
public class ReportData
{
public ReportData(){}
public DataTable GetData(DataTable dt){return dt;}
}
This lets me give my user control a DataTable, then the ObjectDataSource in the control calls ReportData.GetData(_table) in "TheDataSource_Selecting()" which just turns around and gives it right back...crazy, right?
I think the tehnical term is "jumping through hoops", but hey, it works.
I've got left side navigation that loads documents, either htm or PDF into an iFrame to the right. Every browser worked fine except Safari. I could load a web page into the iFrame, then another, but as soon as I loaded a PDF, it would never update when I set the 'src' attribute to a new URL. I popped an alert box to see what the src value was, and it _was_ setting it, but never rendered the new URL after I had put a PDF in there.
I opened the Javascript console, and saw a message having to do with cross-domain security, but I'm working in one domain, so I put that aside. I thought, well, I could tear down the iFrame, construct a new one on the fly and replace it in the DOM...it could work. I tried it and it worked, so I tried to simplify from there.
It turned out all I had to do was set the src to the new URL, then remove the iFrame from the DOM and just add it right back. That was enough to get Safari to render the darn thing.
Here's what I did...
var iFrame = document.getElementById('myFrame');
var parent = iFrame.parentNode;
parent.removeChild(iFrame);
parent.appendChild(iFrame); Yeah...I know...this should really have no effect, but it works. The parent is just a div that only contains the iFrame, so I didn't have to worry about which child it was. It was the only child.
I've been doing some HTML DOM parsing do deal with JSON return values and decided it would be quicker to use document.getElementsByTagName('myCustomTag') to get just the pieces I wanted.
This works fine, except in Internet Explorer. It finds only the opening tag, and says that it has no children. Of course, the other browsers did it right and it works fine.
So, the trick you have to do with IE to make this work has to do with the HTML namespaces.
In your <html> tag, include xmlns:blah=http://www.blah.com (obviously customizable)
Then name your custom tags like this
Now, when you do a document.getElementsByTagName('MyTag')[0] you'll get a full-fledged DOM object with children, etc. It's not the most obvious thing to do, but it works.
In the web.config file, under
Here's a sample command line that encrypts the identity tag. This is all one line by the way...
%windir%\microsoft.net\framework\v2.0.50727 \aspnet_regiis -pef system.web/identity d:\locationToMyWebsite\webSiteName -prov DataProtectionConfigurationProvider
To undo it, just replace "pef" with "pdf" and remove the -prov switch. The "e" is for encrypt, and the "d" is for decrypt. Also replace the v2.0.50727 to the version of .Net you're using if it's not 2.0.
You could go through the trouble of creating your own provider, exporting keys to XML files for use on a server farm, etc. but if you're just running an app on one server, take the easy road and just use the DataProtectionConfigurationProvider. Keep in mind that you need to deploy first, then do the encryption because if you do it on one machine, then move it to another, it won't work.
The trees were neat. A lot of them were curvy and bumpy with moss and other plants growing on them. Here's one that looks like it has a tumor. It was like visiting an old neighborhood where every house looks different. This wasn't a bunch of straight power-pole-like trees. Although if you look to the left of the tumor you can see a power pole.
It's only a short walk to the beach, and by the looks of this sign, if you have a really-really-really old car, you can't go down this particular path.
This heron was eating well. He'd walk ever so slowly then dart his head in the water and swallow what he caught. He was fun to watch.
This piece of wood sticking out of the ground looks like a little city in some Lord of the Rings type of movie. I can imagine little people walking around everywhere.
The coolest thing at the beach was the millions of black sand dollars. Maybe there's another name for them, but that's what they looked like to me. Here's a close-up.
To get around it, I used the following:
((DateTime)itm["Est. Start Date"]).ToShortDateString()