Jun18

Some Fun Web Part Errors from Today

So, many issues I had to resolve today were typical over-rushed developer stuff: non checking for nulls, not testing with users that don’t have MySites, yadda yadda.

 

Two errors stood out as things I'd like to help people avoid doing.

 

First, the developer of the web parts I am fixing failed to make a distinction between System.Web.UI.WebParts.WebPart and Microsoft.SharePoint.WebPartPages.WebPart. They are almost identical, but each implements Web Part Properties in code slightly differently.

using com = System.ComponentModel;
using aspnetwebparts = System.Web.UI.WebControls.WebParts;
using wsswebparts = Microsoft.SharePoint.WebPartPages;

...

// for System.Web.UI web parts
[aspnetwebparts.Personalizable(aspnetwebparts.PersonalizationScope.Shared)]
[aspnetwebparts.
WebBrowsable(false)]
[com.
Category("Configuration")]
[aspnetwebparts.
WebDisplayName("Parent Category ID")]
[aspnetwebparts.
WebDescription("Determines the Parent Category from the Categories List on the Taxonomy Administration site")]

// for WSS web part
[wsswebparts.WebPartStorage(wsswebparts.Storage.Shared)]
[com.
Browsable(false)]
[wsswebparts.
SPWebCategoryName("Configuration")]
[com.
DisplayName("Parent Category ID")]
[com.
Description("Determines the Parent Category from the Categories List on the Taxonomy Administration site")]

This was probably a copy-pasta error, but he used the System implementation instead of the SharePoint one. As a result, none of these web part properties actually showed up where users could change them.

 

To be honest, I used to make this mistake all the time, especially when copying properties from other web parts I had written. These days, I just suck it up and define all of the attributes so I don't have to deal with this issue.

 

That was actually good news, because it means that maybe with a little more work, this solution will be about 10x as configurable as it is now.

 

The second thing almost drove me crazy, because it was very similar to a problem I saw a year ago (or more) and I couldn’t remember what it was. It turned out in the end this was a slightly different issue, but I digress. The problem was that when you have a Tool Pane Editor (basically a fancy custom Web Part Property) and it is used to set a WPP that’s also visible in the browser, the WPP will overwrite the changes that the TPE makes. So for example, you pick "IT Apps" in a dropdown TPE. The TPE goes and looks up the List ID for "IT Apps", and comes back with “15” and saves that to the WPP called Parent ID, but since Parent ID is also visible in the web page and has a value of “” (empty) the empty value then overwrites the “15” and you’re back where you started. The solution here is to hide the WPP by setting Browsable/WeBrowsable = false, thus proving it’s not how much code it takes to fix a bug but finding the correct line to change. J

 

To the developer's credit, I was the one who set this to true, because I was trying to make it visible so I could troubleshoot the ToolPane picker. Oops!

 

(By the way Ted, I hope you're settling in nicely at DOE. <grin>)

Published: Jun-18-09 | 0  Comment | 0  Link to this post

May19

Corrupted Blog Category Page

Symptoms: After a user has changed the system generated view and/or Posts web part. You may see more than one Posts web part. You may also see that clicking the links in the Categories listed along the left hand side of the page no longer produces filtered results, or returns no results where they are expected.

 

WARNING: Do not try this unless you are completely unafraid of messing everything up and having to move your blog content to a completely new site/list.

 

Solution:  Determine which of the multiple Posts web parts are behaving correctly. If some web parts have been closed, you may need to do this using SharePoint Designer. Reopen all closed Posts web parts by right clicking and selecting Web Part Properties, then uncheck the Close Web Part box in Appearance section. If any Posts web part behaves correctly, you may safely delete (do not close) the other web parts.  To remove web part customizations, save the page, then right click and Revert to Site Definition. In some situations, if the user has deleted the functional version of Posts web part, this solution may not work.

 

Recommended Future Action: Designers/users should make a copy of Categories.aspx and work with the copy to determine their changes do not have negative effects before implementing those changes on the system generated pages.

Published: May-19-09 | 0  Comment | 0  Link to this post

Mar31

Import Hyperlinks with Text into SharePoint Lists Using Excel

Suppose you have a list of URLs that your client has given you. Now suppose they also have stored the text for each URL in a seperate column alongside the URL. At first it might seem difficult to get this into a Hyperlink field on a SharePoint list, especially since the UI for the Datasheet view does not allow for each updates to these two pseudo-sub-fields seperately. You might be tempted to enter them both as simple text fields and use a calculated field and a data view (or some other nonsense) to get what you want. Don't, because it's actually quite easy.
 
Instead, bring your columnar data into Excel. Then in a blank column, use the HYPERLINK(url, text) formula to generate the links. Reference the calls to each column respectively within the formula. When you copy these into a SharePoint datasheet view, the text of the links will be preserved. Violla!
Published: Mar-31-09 | 1  Comment | 0  Link to this post

Mar30

Dynamic Data Source Controls for Your Data Form Web Parts

In this very, very, *very* old (but still interesting) ASP.net article on MSDN Magazine, I found the following clever code snippit that uses a temporary file to create a user control dynamically from a string:
 
TemplateColumn bc = new TemplateColumn();
String tmp = Session.SessionID + ".ascx";
StreamWriter sw;
sw = new StreamWriter(Server.MapPath(tmp));
sw.Write(strLayoutCode);
sw.Close();
bc.ItemTemplate = Page.LoadTemplate(tmp);
grid.Columns.Add(bc);
File.Delete(Server.MapPath(tmp));

 
This is indeed pretty neat, but it turns out it's not necessary. You can do the same with the following:
 
Page.TemplateControl.ParseControl(strLayoutCode);
 
I discovered this interesting fact after realizing that SharePoint's DataFormWebPart is doing some intriguingly useful (but obfuscated) stuff with DataSourceControls and the SQL database. Basically, in the SharePoint Designer, whatever controls you put inside the DataSources tag - using the design pane, I would assume - get serialized into a BLOB in the WebParts table of your WSS Content database. At run time, they get loaded from the database on the first call to get the DataSources collection, which typically happens during CreateChildControls.
 
I tried forcing a load by explicitly setting DataSourcesString within code, but it blew up because the parser did not understand the tag prefixes in the code that I inserted. It was then that I realized that SharePoint is leveraging ParseControl(string), and after digging in the database, I was able to see that SPD must be programmatically determining what namespaces to register when it saves the data to SQL by way of the DataSourcesString property.
 
This is useful to me because for a long time I have been thinking that SharePoint, and in a greater sense ASP.net needed a way to allow data source controls to be defined more flexibly and in a centralized location. Sure, you can do it programmatically. But, the control parser gives you a fairly efficient way of doing it using a repeatable and flexible process, and you won't be limited to keeping the controls on the filesystem.
 
If you want to leverage this functionality without giving up the other benefits of the Data Form, check out SPARK project over at CodePlex. It includes Flex Data Form, a version of the DFWP that inherits all the same features as the original, but allows you to set the DataSources string and some other properties from within the Web UI. (It also has some other nifty features as well.)
 
Update: Looks like I am not the only one thinking along these lines. Too bad his comments are closed, because his ideas are good ones and he deserves the Whuffie. :-)
 
More Data Form goodness, especially a decent explaination of the OOTB method for overcoming the list GUID issues that plague migration of the DFWP.
Published: Mar-30-09 | 0  Comment | 0  Link to this post

Mar16

Trials and Tribulations with the Family PVR

Call me a glutton for punishment, but I was never the kind of person who would run out and get a Tivo if instead I could get something more hardcore that I had more features and I could fiddle with more. Thus, long before Tivo offered network streaming, we had outfitted all of our TVs with ReplayTV units and were happily backing up our shows to our file servers hard drives. But, while they were good, SonicBlue and the ReplayTV have long since run their course, and left us looking for another solution.
 
So, a year or two ago, I converted our setup to use a storebought PC, a copy of Beyond TV (I think it was v4.7 at that time), and a Hauppauge WinTV-1600 HDTV tuner card. This system worked pretty well overall, with a couple notable shortcomings.
 
First, the channel changing via IR to our DirecTV D10 and H10-100 boxen were never quite right, and the serial and USB ports for each came with their own headaches. Both had required a Paterson Tech TV Translator to get them working on the ReplayTVs, and this was also true for BeyondTV. This was especially true for the H10 when DTV started mucking around with HD channels that had the same channel number as their SD counterparts, but were not brought up by default. The H10 box also still gives me grief to this very day, because it occassionally stops responding to channel change signals and the USB has to be un/re-plugged. The TV Translator for the D10 has quit working after many years and I think it is dead, but I would be pretty happy if I could only find the spare we put into storage.
 
Second, there was never really any practical solution to record HDTV quality video from DirecTV, so unless we were watching live anyway, the picture quality generally stank - a fact that became all too apparent as we upgraded our 29" tube to a 42" Samsung flat screen plasma and then again to a 50" Pioneer Elite. I had long yearned for the day when technology would give us a solution to this problem that didn't involve buying a thousand dollar peice of specialized and hacked-to-peices hardware.
 
Finally, I made the mistake of installing BeyondTV on Windows Vista Home Premium, because it was what came preinstalled from HP on the box we bought to replace the ReplayTV. In hindsight that was a mistake, and a lot could have been better if I had only stayed in XP. Video codecs are quirky and their performance isn't so great on Vista (you get tearing and other weird effects even if the CPU isn't maxed out), plus network transfer speeds require all kind of tweaking to even make thm tolerable.
 
Well, that was then. This is now.
 
Last summer Hauppauge released the HD-PVR 1212, an external box capable of recording HD quality at 1080i from component RGB cables. This was an amazing advancement, but unfortunately at first the hardware had some heat issues and driver and software support were sketchy at best. Even though I waited until nearly Christmas to buy one, the one that arrived directly from Hauppauge still needed an RMA due to heat. It would freeze up fairly often, and the BeyondTV would say that it couldn't be found. I guess they were just working through their defective stock, but at least they did replace it right away. I kept it running on the living room set for a few weeks after getting it back from them and at the very least I can say problems were less common.
 
But, I can never leave well enough alone. With the new ability to record 1080 video, having the resources free for HD playback became more important, so  I resolved to reconfigure everything with a client-server model that would offload recording and transcoding onto a seperate box.
 
We got a hold of a Dell PowerEdge 1850 with 2x 2.8GHz Hyperthreaded Xeon CPUs, nice fast dual SCSI HDD (though a little small at only 150GB), dual gigabit NICs, and 8GB of RAM. Even at 3 years old, this is a *sweet* box.
 
I installed Windows Server 2003 R2, the latest HD-PVR drivers, and the Beyond TV 4.9 on this box with few issues. Of course, the PowerEdge does not have a sound card, so I had to plug in a USB sound card to fool the codecs into playing. Also, its video card is a bit weak, so we don't really use the console to watch videos unless we're trying to test the video feeds. It makes sense to keep a small TV nearby the server to do tests on the live video feeds from the set top boxen. It took a little work to get everything configured, especially the new PCIe card we got for SD recordings, but all in all this was not too difficult. We do still have a couple minor issues.
  • The channel changer cable for the H10 still needs a kick now and then.
  • The channel changer cable for the D10 does not respond at all and we think the TV Translator maybe died, but this old beast isn't supported anymore.
  • Beyond TV still does not properly implement h264 conversion for HD, so we get "failed to generate graph" if we try to ShowSqueeze our HD recordings (which right now is all of them).

With recording successfully offloaded to the rack in the basement, I was free to start making improvements upstairs. First thing I did was to uninstall all the deadweight drivers and tools. Then, I installed BeyondTV Link on both the living room and side porch PCs.

The living room set is an HP AMD x64 5000+. It has 4GB RAM, 300GB HDD, and came with Vista like I said above. I put a Sound Blaster Extreme Pro and a BFG NVidia GTX 260 in it, as well as a Netgear 311 gigabit NIC, Firefly RF remote, Logitech Dinovo bluetooth keyboard, Rocketfish bluetooth mouse, and a USB XBox wireless game controller adapter. I've also installed teh CoreAVC codec professional version along with BTV Link.

The kids' is a Dell v64 6400+, and its probably a better machine overall. They inherited my old BFG NVidia 8800 OC, but still use the onboard sound. They also got the 311 NIC and an ATI TV Wonder that isn't really connected to any feeds. For thier output, the TV only had VGA input, so I use a DVI to HDMI converrter and the NVidia control panel to compact the desktop so we can see the start menu.

The current issue on the kids' PC is that when you play video across the network UNC share, it plays fine, but when you play through Link, there is no audio. I don't think this is a big deal; I just haven't had time to figure it out yet.

As for the living room PC, I thought that installing Link would have been adequate, but video was still choppy during fast paced action scenes - which are pretty common in Battlestar Galactica. That just won't do. I tried many different configurations of the codecs and BTV settings, to no avail. Further, video playing directly in GraphEdit was much clearer than in BTV.

What I learned from this is that GraphEdit typically uses VMR7 as the video renderer, whereas what BTV calls "3D Accelerated" is actually VMR9. Having learned this, I then found other people in forums saying that Vista is the problem here, and that both XP and the Windows 7 Beta do much better.

So, I decided to give the beta a try. I ran into some problems trying to shrink my hard drive partition, but eventually I found the right settings and defrag tools to at least let me free up 150 GB for a dual install.

The Win 7 install process was tedious, but relatively pain free. The only 64 bit driver it couldn't find or didn't already have natively was of course for the Netgear 311. I was able to get that working by using Have Disk from the Add Hardware wizard. Hint: don't use the more obvious browse or search, as they will not find the driver file, but if you dig intot he CD from Have Disk, it will be pretty obvious you want the file in the Drivers/Vista/x64 folder. Once I had a network connection, all the other devices configured more or less automatically.

There were several possible x64 drivers from Microsoft and NVidia. I decided to try the one they made available from the CUDA page, but there was no joy for me here, since CoreAVC doesn't really support 64bit CUDA yet.

That's okay though, because just using the new OS gave me a 25% reduction in CPU utilization during HD playback. Video was clean and clear even in fast motion on the same sequences that gave me trouble in Vista. Network throughput also appears to be much better, though I imagine Microsoft will figure out how to screw this up by the time they release Windows 7 Home Edition.

So, that's it. I guess I will keep testing Windows 7 to see if it performs well for me after installing anti-virus software and other garbage. Also, I'm really looking forward to seeing if CUDA support in CoreAVC and BeyondTV gets any better in the future.

Published: Mar-16-09 | 0  Comment | 0  Link to this post

Mar01

Setting up TFS Server and using VSSConverter with VSSConverterGUI

 
I spent the weekend installing and configuring TFS Server 2008. I learned a lot, but mostly it was just a pain. In the end we did get things working properly.
 
After install, I wanted to port over our existing VSS from a past development project. I found this article, Migrate VSS Projects to TFS Projects, which was indeed a useful walkthrough, although it missed some important steps that were necessary for me.
 
First, the VSSConverterGUI is compiled only for Visual Studio 2005. Luckily I did have this older version lingering around still. I installed the TFS Explorer for VS2005 using the link I found on the Team System Blog. Note that the image file is in a wierd format, so I had to install Magic ISO in order to extract it; I really didn't feel like wasting a blank CD for this.
 
You put the GUI exe in the same folder as VSSConverter.exe and it will actually work, which is great. From there, I had to just browse to my VSS and TFS server, which worked very well.
 
The next issue is that I could not get teh User Mappings part of the form to work at all. So, instead, I saved the setting.xml and closed the application, and ended up rolling my own UserMap.xml in the same folder as Settings.xml using the example from the blog walkthrough above. I was able to use SourceSafe 2005 Admin to view the users so the mappings were pretty much intuitive. The other thing to note is the the tool likes it if you save both these XML files to the VSS folder, not the Common7 IDE.
 
Finally, I got the message that says "TF60032: The VSS Converter requires Visual SourceSafe 2005 or later to run. Please install Visual SourceSafe 2005 or later and try again. " like this poor fellow and this one. This was very weird because I *did* have SourceSafe 2005 installed on the very same box and was using it. So, I did some digging and thanks to this article, was able to get it working by adding the following keys to my registry using a REG import file.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SourceSafe]
@="Microsoft Visual SourceSafe Automation"
[HKEY_CLASSES_ROOT\SourceSafe\CLSID]
@="{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}"
[HKEY_CLASSES_ROOT\SourceSafe\CurVer]
@="SourceSafe.8.0"
Finally, the import ran correctly and now all our source code in in TFS!
 
Published: Mar-01-09 | 0  Comment | 0  Link to this post

Feb24

What I Use for Screen Magnification

Those of you who know me probably know that I have low vision - or to put it another way I'm as blind as a bat. :-) Those of you who don't might have been able to figure it out from my picture. It's true my vision is pretty bad. (It varies from about 20/100 to 20/120 with my glasses on.) However, I know there are folks out there who have it far worse than I do.
 
Recently, a colleague of mine here at the IMF asked me what software I use for screen magnification. She has family members of varying levels of computer literacy who have a need for such things.
 
She was thinking about buying JAWS. I don't recommend this unless you are totally blind. JAWS is expensive unless you get a government grant, due to its fairly small base of portential customers - mainly progressive governments and a handful of blind folks who happen to be wealthy beyond reason.
 
Instead, here are three alternatives I suggest for low vision adaptivity on the cheap.
  1. Use the native features of Windows. Most people do not know this, but there are color, font, and magnification tools built straight into Windows nowadays. To find them, go to Start Menu > [All] Programs > Accessories > Accessibility. Mind you they aren't the best I have ever seen, lacking features and sometimes even becoming unstable, but - hey - you can't beat free.
  2. Use this nifty Magnifying Glass application which I believe comes from IBM's ThinkPad or maybe Microsoft.

    Download from ThomasCarpe.com

    It also seems that some other folks posted this on one of those file sharing web sites, but obviously I can't vouche for it being free of viruses or spyware.

    4Share download
    FreeDownloadsPlace download
  3. Dana Hanna, a very talented colleague I worked with while I was at Constellation Energy (he and I have both moved on since then) wrote an amazing little magnifying app, for which he graciously provided source code as well. I've been using this one for quite a while, because it has both features I wanted and the ability for me to add more as I think of them. Of course it's always been just a little buggy, and I guess having source is only an advantage if you happen to be a programmer.

    Torian Magnifier (download and source)
  4. Finally, maybe try this. They seem to have an interesting collection of FreeWare and ShareWare magnification tools, althought some of them appear to be effect filters for Photoshop.

    http://text.software.informer.com/download-text-magnifier-shareware/
Anyway, I hope people will find this list helpful, and if I find any new resources, I will try to keep it up to date.
Published: Feb-24-09 | 0  Comment | 0  Link to this post

Feb23

SharePoint Code Published on CodePlex

After thinking this over for a while, and hiring a new employee, I've decided to truly make my SharePoint library both a more accessible and more collaborative effort by publishing it using CodePlex.
 
 
The SPARK project includes many of the examples published previously in articles from this blog, so those who have commented that you received 401/403 errors here should go there and download the source code. Just search through the files in the Behemoth.SharePoint project it to find the classes mentioned in the blog.
 
Why Behemoth? Well, because at least right now, the code is a big unstoppable monster. There's tons of code that needs to be ported over, (re)tested, and documented. Like any mythic beast, it is powerful and also a little scary. Plus the name fits with the theme of my company Colossus Consulting.
 
I'll be doing more additions and documentation in the coming weeks, so I hope if some of you find the code informative or useful that you'll leave me some love in the comments and reviews. (I also accept beer from those in the DC area.)
Published: Feb-23-09 | 0  Comment | 0  Link to this post

Feb11

Coffee Break at 1600 Pennsylvania Avenue

So, after a filling lunch at Mackey's on L Street, where we said goodbye to our team member Dan Smith, Ted and I strolled over to the White House to have a look around, get some coffee and take advantage of the unusual weather.

Above, you can see them dismantling the "fish bowl" where President Obama and the First Lady stood to greet the crowd just a couple weeks ago. It's taking surprisingly long to tear down, which implies that some aspects of its construction must have anticipated something worse than mere bullets.

Another shot of the aquarium. Leaf blowing guy is making life difficult because Ted can't hear me asking him not to block my shot. J

Here's the front of the White House from the fence. Will lasers and death robots emerge if I put my phone between the bars for a better shot? Let's not try that out today.

Lawn numerous deux.

Here leaf blower guy makes his return appearance, and you can see the rest of the reviewing area and fish bowl tear down. It's hard to say, but I would guess they are taking great care in the demolition, since they seem to be stacking the pieces up on palettes. Perhaps they keep all this stuff so they can reuse it in another four years?

A final shot of the construction. Now it's time to get back to work.

A view up Pennsylvania Avenue lies before us, as we return to the office. From this vantage point, you can just barely see my building a few blocks from here. It's the one that's tan and blue glass just below the third American flag from the left. By the time we reach the intersection, the building is looming across Edward R. Murrow Park, but the World Bank is still mostly obscured by other structures. The view of the White House from our office is reciprocally unflattering.

Published: Feb-11-09 | 0  Comment | 0  Link to this post

Jan23

Tmail.exe (and Other Apps) Hang at 100% CPU in Windows Mobile

So this killed my phone during inaugural weekend. I guess it was just bad timing. I want to make sure I post about it so that other folks can find the solution as well.
 
Basically, you get to a point where you can't send any text messages, because the tmail.exe process is chewing up all your CPU cycles. This can happen to other apps as well. For example, Google Maps has a search feature that also triggered this issue.
 
The problem appears to be the word suggestion engine. I guess the database of suggested words gets too big or too fragmented at some point.
 
To resolve the problem, go to Start > Settings > Personal > Input. Tap the Word Completion tab, then uncheck the box for "Suggest words when entering text". Optionally, you may want to try simply clicking the Clear Stored Entries button to see if that resolves the issue by itself.
 
Personally, I did not get much use from Word Completion - and even found it annoying sometimes - since I have a full qwerty keyboard on my HTC/T-Mo Wing. As a result, I did not mind losing this feature. Your mileage may vary.
 
Now that I have my phone messaging back, perhaps I should blog my experiences from the Inauguration earlier this week?
Published: Jan-23-09 | 0  Comment | 0  Link to this post

 Next >>
`