tag:blogger.com,1999:blog-39303754424977995142008-08-18T11:42:13.896-07:00Eat, Sleep, CodeTom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-3930375442497799514.post-31619400463077322432008-08-15T09:18:00.001-07:002008-08-15T09:20:20.841-07:00Smoggy Freaky SkyA coworker of mine took these photos of the sky last night in Olympia. A good mix of smog, weird clouds, sunshine, and pending darkness...very cool.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_DuNxoM3z_3M/SKWsdWaoxDI/AAAAAAAACEo/GmRDlyVEAjg/s1600-h/DSC_0584_72.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_DuNxoM3z_3M/SKWsdWaoxDI/AAAAAAAACEo/GmRDlyVEAjg/s400/DSC_0584_72.jpg" alt="" id="BLOGGER_PHOTO_ID_5234779762121557042" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_DuNxoM3z_3M/SKWsm0qgK8I/AAAAAAAACEw/hLX3YUB6H6M/s1600-h/DSC_0589_72.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_DuNxoM3z_3M/SKWsm0qgK8I/AAAAAAAACEw/hLX3YUB6H6M/s400/DSC_0589_72.jpg" alt="" id="BLOGGER_PHOTO_ID_5234779924859988930" border="0" /></a>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-26292017868510944912008-07-31T14:38:00.001-07:002008-07-31T14:40:11.499-07:00Session is null in ashxIf the HttpContext.Current.Session is null in your .ashx handler, add System.Web.SessionState.IReadOnlySessionState to your class declaration, like this:<br/><blockquote style="font-family:courier">public class MyHandler : IHttpHandler, System.Web.SessionState.IReadOnlySessionState</blockquote><br/>That's it!Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-21379480584432786522008-07-31T13:15:00.000-07:002008-07-31T13:41:20.631-07:00ASP.NET GetElementById for server controlThis comes up a lot. You have a server control with an id like "txtName" and you need to reference that with Javascript, but when the page renders, if that textbox is within another server control, the id will change to something like "ct100$something$txtName". There are two ways to deal with this.<br/><br/><b>Deal with it at the server</b><br/>If you're creating the JavaScript in the code-behind on the fly, then you can use the txtName.UniqueId, but sometime's there are colons in it that need to be underscores, so you can get the id like this:
<blockquote style="font-family: courier;">txtName.UniqueID.Replace(":","_")</blockquote>
You can then build your JavaScript like this:
<blockquote style="font-family: courier;">ClientScript.RegisterStartupScript(this.getType(),<br/>"blah","alert('"<br/>+ txtName.UniqueID.Replace(":","_")<br/>+ "');",true);</blockquote>
<b>Or, Deal with it at the client</b><br/>
Sometimes you need to have your JavaScript pre-written, like in a .js file. So, to find the control that has the id you want, what you really need to do is find the control who's id ends with the thing you're looking for.<br/><br/>Here's how I do it...<br/>
<blockquote><pre style="font-family: courier;">function GetElementByIdEndsWith(tagName,endsWith)
{
var elements =
document.getElementsByTagName(tagName);
for(var i = 0; i < elements.length; i++)
{
if (elements[i].id.endsWith(endsWith))
{
return elements[i];
}
}
return null;
}
String.prototype.endsWith = function(txt,ignoreCase)
{
var rgx;
if(ignoreCase)
{
rgx = new RegExp(txt+"$","i");
}
else
{
rgx = new RegExp(txt+"$");
}
return this.match(rgx)!=null;
}</pre></blockquote><br/>You can call it like this:<blockquote style="font-family:courier">var x = GetElementByIdEndsWith("input","txtName");</blockquote>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-70108302854580763232008-07-22T08:21:00.000-07:002008-07-23T08:35:07.415-07:00SharePoint debugging on a TuesdayI'm working on some SharePoint customization from my home office... You know how when you're trying to remember something or figure something out and you sort of look up? Yeah...I just did that. The spider in the picture below looked right back at me. Suddenly SharePoint wasn't my problem. I had more immediate debugging to do. Had I not seen this type of spider before I would've been more in the smashing squishing mode than a picture taking mode, but I have, so I took a few shots. You can't tell from this angle, but he's smiling. I've searched for this guy online before. They're pretty harmless, but scary as heck. It's called the "giant house spider"...yeah, duh. I'm sure it took no more than 3 seconds to name it when the first person saw one.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SIX9ifS-WsI/AAAAAAAAB-4/MDjgpq6TIoE/s1600-h/7-22-08-spider_2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SIX9ifS-WsI/AAAAAAAAB-4/MDjgpq6TIoE/s400/7-22-08-spider_2.jpg" alt="" id="BLOGGER_PHOTO_ID_5225861711591791298" border="0" /></a>
<blockquote>You can't tell the actual size because there's nothing in the picture to compare it to, but I can tell you it was about the size of a 50-cent piece.</blockquote>
The first time I saw one of these was about five years ago. We had some other bug problems in the house so we bought the house-fogger-bug-killer-can-things. I think that's what they're called... ha ha. They killed every bug in the house...except these guys. Basically we killed all of their food, so they all came up from the dank darkness of the basement and underside of the house looking for something to eat. All they found was scared people and ultimately...death by shoe, fly swatter, rock, etc. I'm glad I don't live there anymore, but I guess they're all around since one came to visit today. I'm not sure how to spell this but I'll try... Eeeewwwww!Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-27006135352174305962008-06-12T13:13:00.000-07:002008-06-17T15:57:48.332-07:00Firefox add-onsThere are 3 Firefox add-ons I use daily. Together, they save me a lot of time during web development. I don't know how I ever lived without them.
<ol><li><b><a href="https://addons.mozilla.org/en-US/firefox/addon/5792" target="_blank">Firesizer</a></b>
<ul>
<li>Lets you change your browser size to 800x600, 1024x768, etc.</li>
<li>Lets you create your own custom sizes</li>
<li>Always shows you the current dimensions of your browser</li>
</ul>
</li><li><b><a href="https://addons.mozilla.org/en-US/firefox/addon/1419" target="_blank">IE Tab</a></b>
<ul>
<li>Lets you view pages using an IE browser right inside Firefox.</li>
<li>This not only lets me stay in Firefox all day, but also lets me instantly switch browsers to see how a page looks in one or the other.</li>
<li>You can even run active-x controls when viewing in IE mode.</li>
</ul> </li>
<li><b><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" target="_blank">Firebug</a></b>
<ul>
<li>This one should just be called 'awesome'.</li>
<li>Lets you debug code, add, modify, or delete page elements while you're looking at the page</li>
<li>Lets you hover over any part of the page and see the elements and style hierarchy</li>
<li>I'll say it again: This one should just be called 'awesome'.</li>
</ul>
</li></ol> Firebug has been the most useful, but the other two are still awesome!Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-23080187377183261082008-06-10T14:33:00.000-07:002008-06-10T14:56:39.607-07:00JavaScript endsWith() and trim()Today I needed a new JavaScript string function to see if the end of a string matched something. In ASP.NET, when controls within other controls get written as HTML, the id's get prepended with a bunch of junk from the container controls. So, for your JavaScript functions to find a particular control, it's useful to use document.getElementsByTagName('input') for example to get a list of input tags, then iterate the list testing the end of the id attribute to find a particular control. Anyway, I used 'prototype' to add an endsWith(x) function to strings.
Here it is. I hope you find it useful.<blockquote><pre>
String.prototype.endsWith = function(txt,ignoreCase)
{
var rgx;
if(ignoreCase)
{
rgx = new RegExp(txt+"$","i");
}
else
{
rgx = new RegExp(txt+"$");
}
return this.match(rgx)!=null;
}
</pre></blockquote>For example: 'hello'.endsWith('LO',true) returns true. Notice I passed in a true value for the ignoreCase parameter.
Or with a variable: var x = 'goodbye'; then x.endsWith('bye') returns true.
While I'm here, here's a cool one liner that will do a trim() on both sides of a string.
<blockquote><pre>String.prototype.trim = function()
{
return this.replace(/(^\s*|\s*$)/g,'');
}
</pre></blockquote>For example: alert('.' + ' blah '.trim() + '.'); shows ".blah."Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-43501401145665789852008-06-04T15:16:00.000-07:002008-06-04T15:20:42.167-07:00Response.Redirect ResolveUrl failsI had a Response.Redirect fail today. The url was something like this: "~/blah/blah.aspx?id=5&time=3:30". Response.Redirect, when it sees the "~" character, does a ResolveUrl() call under the hood. That's really what was failing. It wouldn't resolve my url, so I kept removing parameters until it worked. It was choking on the ":" character.
The solution was to do a myUrl.Replace(":","%3A"). I don't know why it can't handle the ":" and wonder if there are other characters it has a problem with.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-31382485717860566692008-05-30T13:16:00.000-07:002008-05-30T15:07:42.468-07:00Aftermarket helmet lockThe saddle bags on our bikes cover the stock helmet lock rendering it completely useless, so we went for an aftermarket solution. Here's the <a target="_blank" href="http://www.bikesax.com/Merchant2/merchant.mvc?Screen=PROD&Store_Code=B&Product_Code=HL101B&Product_Count=&Category_Code=">site where we got it</a>. I installed it today, and hung my helmet for the first time...pretty cool.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_DuNxoM3z_3M/SEBhUGJNvmI/AAAAAAAAB4U/ec2s65ZLgxI/s1600-h/helmetlock.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_DuNxoM3z_3M/SEBhUGJNvmI/AAAAAAAAB4U/ec2s65ZLgxI/s400/helmetlock.png" alt="" id="BLOGGER_PHOTO_ID_5206268167114833506" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_DuNxoM3z_3M/SEBjgB4mYAI/AAAAAAAAB5U/-NSZrmtgLdk/s1600-h/helmetlockclose.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_DuNxoM3z_3M/SEBjgB4mYAI/AAAAAAAAB5U/-NSZrmtgLdk/s400/helmetlockclose.png" alt="" id="BLOGGER_PHOTO_ID_5206270571153088514" border="0" /></a>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-57335941046757810372008-05-30T10:47:00.000-07:002008-05-30T10:53:32.028-07:00The Office & B.J. NovakI'm so jazzed right now. I'm a huge fan of "The Office" and tonight I'm going to see B.J. Novak (Ryan) do stand-up. He writes for the show and produces too. This is going to be good!Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-89469100002308181002008-05-28T13:04:00.001-07:002008-06-17T16:01:02.913-07:00Ordering columns in a GridView - it's not magicI (and others) have found a bug in ASP.NET's new GridView control. Something that worked with the old DataGrid doesn't work in the new version.
<br/><br/>
Scenario: I had to reorder my gridview's columns at runtime to support custom report views for users. I have a list of columns that the person wishes to see, and a bunch of predefined columns built into the grid using the standard declarative syntax. So, in code, I loop through the user's requested columns and find them in the grid, then move them to the end of the grid by calling myGrid.Columns.Add(theColumn) and myGrid.Columns.RemoveAt(x) methods. I then set the visible property to false for all other columns. The columns reorganize just as I want, but any columns of type TemplateField end up with blank data (actually empty control collection) when the grid is rendered. Ouch! Apparently the template column data is saved in the viewstate, but not the template column's control tree, so when you move the column, that part is lost and the grid looks empty for those columns.
<br/><br/>
Unexpected solution: I'm using the gridview's built in sorting and paging....which is awesome, and surprisingly not dependent on EnableViewstate being set to true. Turning off EnableViewstate fixed my disappearing template column stuff and the sorting and paging still magically work.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-48836507797894023262008-05-19T10:32:00.000-07:002008-05-20T12:31:45.689-07:00Hangin' out & riding<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SDG6TgP5NgI/AAAAAAAAB3Y/4NvsFcWYr_4/s1600-h/Cimg0205_400.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SDG6TgP5NgI/AAAAAAAAB3Y/4NvsFcWYr_4/s400/Cimg0205_400.png" alt="" id="BLOGGER_PHOTO_ID_5202143888826512898" border="0" /></a>
Here's a pic of Rich, Kayleen, Stephanie, and me waiting to listen to <a target="_blank" href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=37063893">Klementine</a> play. That's a band that's playing at our wedding in October. Oh yeah, I guess I could've mentioned that earlier! <a target="_blank" href="http://www.kitsapsun.com/news/2008/may/18/engagement-bystrom-puleo/">Stephanie and I are engaged</a>. 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.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-84967590405247702152008-05-15T12:42:00.000-07:002008-05-15T12:47:54.014-07:00Motorcycle MPGIt's silly when people think about getting a motorcycle to save money on gas. Sure, you'll get great gas mileage with a bike, but you just paid anywhere from $3k to $10k on the bike!
So, I didn't spend money on a bike to save money on gas, but I am impressed with the mileage on these Hondas. My last 3 tanks I've gotten between 59 and 60 mpg. My car gets 38 to 40 and my old bike, a '96 Kawasaki ZX-11 Ninja, only got 37. I'm not saving a ton of money riding the bike over driving the car, but I do have a lot more fun.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-67567098278832127242008-05-13T14:23:00.000-07:002008-05-13T14:37:56.173-07:00SPSecurity.RunWithElevatedPrivilegesIn the code-behind of a SharePoint page layout, I needed to modify the quicklaunch (left-side) navigation and add a few folders to the document library if they didn't exist.
I retrieved the current SPWeb like this: <blockquote><pre>SPWeb web = SPContext.Current.Site.OpenWeb();</pre></blockquote>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 <a target="_blank" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1402252&SiteID=1">forum entry</a> 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:
<blockquote><pre>
SPSecurity.RunWithElevatedPrivileges
(delegate()
{
SPWeb aWeb = (new SPSite(web.Url).AllWebs[web.ID]);
aWeb.AllowUnsafeUpdates = true;
BuildLeftSideNav(aWeb);
});
</pre></blockquote>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.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-82172314857094583602008-05-06T09:10:00.002-07:002008-05-06T09:17:57.361-07:00Using the ObjectDataSource<div class="itemBodyStyle"> <p>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.</p> <p>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.</p><blockquote><pre><span style="font-size:85%;"><span style="font-size:100%;">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);
}</span>
</span></pre></blockquote><p>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.</p> <p>Here it is...</p>
<blockquote><pre><span style="font-size:85%;"><span style="font-size:100%;">public class ReportData
{
public ReportData(){}
public DataTable GetData(DataTable dt){return dt;}
}</span>
</span></pre></blockquote><p>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?</p> <p>I think the tehnical term is "jumping through hoops", but hey, it works.</p></div>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-59164980216460547452008-05-06T09:09:00.000-07:002008-05-06T09:18:14.296-07:00Safari iFrame Gymnastics<p>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.</p> <p>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.</p> <p>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.</p> <p>Here's what I did...</p> <blockquote><pre><span style="font-size:100%;">var iFrame = document.getElementById('myFrame');
var parent = iFrame.parentNode;
parent.removeChild(iFrame);
parent.appendChild(iFrame);</span></pre></blockquote> <p>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.</p>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-31400449840527654142008-05-06T09:07:00.002-07:002008-05-06T09:18:20.832-07:00Remote DebuggingI've got an asp.net app running on a server, VS2008 running on my desktop, and I can attach the VS debugger to the w3wp.exe processes on the server. When you hit the website in the browser, the breakpoints in your local code just work.
Here's how I set it up...
<ol><li>I copied msvsmon.exe and msvsmon.exe.config to a folder on the server
On my box, they were at "c:\program files\microsoft visual studio 9.0\common7\ide\remote debugger\x86" (There are x64 and ia64 folders as well) </li><li>I launched msvsmon.exe on the server
This creates a monitor called [myLoginName]@servername </li><li>In the Tools-Permissions window, I added my regular login account as having debug rights (I have to log into the server as an admin account) </li><li>On my dev box, in Visual Studio, I chose Debug-Attach to process </li><li>I typed in [myAdminLoginName]@servername to match the name of the monitor </li><li>I clicked the Refresh button, and voila! -- a list of processes</li></ol>There's one downside. When I do step 3, then close msvsmon.exe, it doesn't remember that I added my account the permissions, so each time I run it I have to re-add the permission. Luckily remote debugging isn't something we do on a daily basis.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-73084812566702164022008-05-06T09:07:00.001-07:002008-05-06T09:07:34.636-07:00Matching Process ID with App PoolI was troubleshooting a memory problem with a group of ASP.NET sites in a particular App Pool. In IIS, I can see which applications are in which application pool, and in the Task Manager, I can see multiple w3wp.exe processes, but how do you tell which Process ID goes with which App Pool?
There's a simple command line you can run on Windows Server 2003 to do just that.
cscript.exe %windir%\system32\iisapp.vbs
This gives you a nice dump of exactly what you need.
W3WP.exe PID: 1400 AppPoolId: MyAppPool1
W3WP.exe PID: 920 AppPoolId: SomeOtherAppPoolTom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-6275047241299382802008-05-06T09:05:00.000-07:002008-05-06T09:07:03.152-07:00IE Dom and Custom HTML Tags<p>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.</p> <p>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.</p> <p>So, the trick you have to do with IE to make this work has to do with the HTML namespaces.</p> <p>In your <html> tag, include xmlns:blah=http://www.blah.com (obviously customizable)</p> <p>Then name your custom tags like this <blah:mytag>...</blah:MyTag> instead of just <mytag>...</mytag>.</p> <p>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.</p>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-78517460756818519522008-05-06T09:03:00.000-07:002008-05-08T12:31:20.008-07:00Encrypting the identity tag in web.config<p>In the web.config file, under <system.web> you have</system.web></p> <p> </p><blockquote style="font-family: courier;"><identity impersonate="true" username="fred" password="flintstone"></identity></blockquote> <p>Here's a sample command line that encrypts the identity tag. This is all one line by the way...</p> <blockquote style="font-family: courier;">%windir%\microsoft.net\framework\v2.0.50727 \aspnet_regiis -pef system.web/identity d:\locationToMyWebsite\webSiteName -prov DataProtectionConfigurationProvider</blockquote> <p>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.</p> <p>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.</p>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-950695772824113722008-05-05T08:58:00.000-07:002008-05-05T14:23:36.552-07:00CampingThis last weekend was my first time (ever) camping, and it was really fun. Part of it was because it was new, but most of it was because my lady is an experienced camper. We had everything we needed. Not just stuff, but processes about how to deal with the stuff. The trip was very organized; the kind of organization you'd expect if you paid some outdoors firm to take you camping if you had no idea what to do or what to bring. There was no rushing, no stress, and no computers. (c'mon, I need to get away from 'em sometimes)
The weather said chance of rain, but it didn't even sprinkle until we had everything set up Friday, then a little bit over night and Saturday morning. We were perfectly dry the entire time. Here's what the campsite looked like when we got there, and then after we'd set up.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_DuNxoM3z_3M/SB8xMvtlJGI/AAAAAAAABz0/C8T0EnxnaGs/s1600-h/before.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_DuNxoM3z_3M/SB8xMvtlJGI/AAAAAAAABz0/C8T0EnxnaGs/s400/before.jpg" alt="" id="BLOGGER_PHOTO_ID_5196926590044677218" border="0" /></a>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_DuNxoM3z_3M/SB8xMvtlJHI/AAAAAAAABz8/txbQUAu8i4E/s1600-h/after.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_DuNxoM3z_3M/SB8xMvtlJHI/AAAAAAAABz8/txbQUAu8i4E/s400/after.jpg" alt="" id="BLOGGER_PHOTO_ID_5196926590044677234" border="0" /></a>
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 <span style="font-style: italic;">can</span> see a power pole.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_DuNxoM3z_3M/SB8xM_tlJII/AAAAAAAAB0E/LtUEN8-MecM/s1600-h/tumor.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_DuNxoM3z_3M/SB8xM_tlJII/AAAAAAAAB0E/LtUEN8-MecM/s400/tumor.jpg" alt="" id="BLOGGER_PHOTO_ID_5196926594339644546" border="0" /></a>
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.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SB8xNPtlJJI/AAAAAAAAB0M/SuqtHEi9YhY/s1600-h/nocar.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SB8xNPtlJJI/AAAAAAAAB0M/SuqtHEi9YhY/s400/nocar.jpg" alt="" id="BLOGGER_PHOTO_ID_5196926598634611858" border="0" /></a>
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.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SB85kPtlJMI/AAAAAAAAB0k/vQNKe0rb-pI/s1600-h/heron.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SB85kPtlJMI/AAAAAAAAB0k/vQNKe0rb-pI/s400/heron.jpg" alt="" id="BLOGGER_PHOTO_ID_5196935789864625346" border="0" /></a>
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.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_DuNxoM3z_3M/SB856_tlJNI/AAAAAAAAB0s/6ABRrDsG6TU/s1600-h/city.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_DuNxoM3z_3M/SB856_tlJNI/AAAAAAAAB0s/6ABRrDsG6TU/s400/city.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5196936180706649298" /></a>
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.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_DuNxoM3z_3M/SB8ysvtlJKI/AAAAAAAAB0U/Rywr-XDl-3s/s1600-h/close.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_DuNxoM3z_3M/SB8ysvtlJKI/AAAAAAAAB0U/Rywr-XDl-3s/s400/close.JPG" alt="" id="BLOGGER_PHOTO_ID_5196928239312118946" border="0" /></a>
And here's a broader shot...literally, millions of them.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_DuNxoM3z_3M/SB8ys_tlJLI/AAAAAAAAB0c/nXtncg4mY2c/s1600-h/far.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_DuNxoM3z_3M/SB8ys_tlJLI/AAAAAAAAB0c/nXtncg4mY2c/s400/far.JPG" alt="" id="BLOGGER_PHOTO_ID_5196928243607086258" border="0" /></a>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-10238553078164249532008-05-02T14:25:00.000-07:002008-05-06T09:11:42.398-07:00SharePoint bug in GetFormattedValueI'm grabbing list values programmatically in SharePoint. On the Microsoft.SharePoint.SPListItem, I call GetFormattedValue("myFieldName") and if that field is a date, it displays the day before the date that's stored in the list. Ouch.
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_DuNxoM3z_3M/SBuHxvtlJBI/AAAAAAAAByc/h29HHDzoLso/s1600-h/spbug.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_DuNxoM3z_3M/SBuHxvtlJBI/AAAAAAAAByc/h29HHDzoLso/s400/spbug.png" alt="" id="BLOGGER_PHOTO_ID_5195895883792983058" border="0" /></a>
To get around it, I used the following:
<span style=";font-family:courier new;font-size:85%;" >((DateTime)itm["Est. Start Date"]).ToShortDateString()</span>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-62858208395411770202008-05-02T10:23:00.000-07:002008-05-02T10:32:10.443-07:00Mmmm... leather...Here are some more pictures, showing off our leather. :)
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SBtOcPtlI7I/AAAAAAAABxU/_qCQCW2QG2w/s1600-h/both.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SBtOcPtlI7I/AAAAAAAABxU/_qCQCW2QG2w/s400/both.JPG" alt="" id="BLOGGER_PHOTO_ID_5195832842263012274" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_DuNxoM3z_3M/SBtOlftlI9I/AAAAAAAABxk/bjNUC-XPeyg/s1600-h/tom.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_DuNxoM3z_3M/SBtOlftlI9I/AAAAAAAABxk/bjNUC-XPeyg/s400/tom.JPG" alt="" id="BLOGGER_PHOTO_ID_5195833001176802258" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_DuNxoM3z_3M/SBtOhPtlI8I/AAAAAAAABxc/MGTmILrOknE/s1600-h/steph.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_DuNxoM3z_3M/SBtOhPtlI8I/AAAAAAAABxc/MGTmILrOknE/s400/steph.JPG" alt="" id="BLOGGER_PHOTO_ID_5195832928162358210" border="0" /></a>
We both have <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Thinsulate</span> lined gloves for cold weather, and the other morning we found out that they work, but not for long. 30 minutes into our ride our hands were freezing cold. But it <span style="font-style: italic;">was </span>38 degrees when we left, so maybe that's to be expected. ha ha. Anyway, we'll be looking into getting heated hand grips for the cold mornings, evenings, etc.Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.comtag:blogger.com,1999:blog-3930375442497799514.post-2196832234453632482008-04-28T12:36:00.000-07:002008-05-06T09:39:25.943-07:00Summer fun<span style="font-family:georgia;">Stephanie and I just got new motorcycles. Well, they're used, but new to us. They're both 2005 Honda Shadow Aero's (750 cc). Hers has red where mine has silver. I'll post pics of us wearing our cool leather gear soon, but for now, here's the bikes.
</span><img id="BLOGGER_PHOTO_ID_5195863018703234018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://bp0.blogger.com/_DuNxoM3z_3M/SBtp4vtlI-I/AAAAAAAABxs/RlXHgtl6z74/s400/bikes.JPG" border="0" /><img id="BLOGGER_PHOTO_ID_5197305169936983282" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://bp2.blogger.com/_DuNxoM3z_3M/SCCJg_tlJPI/AAAAAAAAB3Q/dmy3_CRRq04/s400/Cimg0740-small.jpg" border="0" />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh3.ggpht.com/tapuleo/SAJCDoLGy3I/AAAAAAAABmU/w_fxQRESRds/CIMG0632.JPG?imgmax=512">
</a>Tom Puleohttp://www.blogger.com/profile/10697521511530638404noreply@blogger.com