Friday, December 22, 2006

It's been awhile

Sorry it's been so long since my last posts. I just started a new a job and the new company blocks blogger so I have to do my posts at home now. With the new job and Christmas, things have been kind of hectic. I'll try to post stuff as often as possible.

FYI, The new job uses VB.Net as their standard (which I had never done before) so I will start posting fun things I learn about VB.Net as well.

Free Ringtone Maker

I read about a cool little web tool the other day. It let's you upload a audio file and do some edits and download it again as a ringtone. Seems very cool.

I found it here:

Free Ajax Ringtone Maker

Thursday, November 30, 2006

DOMTool

Have you ever wanted to take some html code and have javascript create that same html dynamically?! Trying to do this by hand can be a very tedious process (especially if your html is more than a few lines). Someone has put together a tool that will take your html and produce the javascript that would recreate that html on the fly. A very handy tool...

Here's the Ajaxian.com link to it.

Friday, November 17, 2006

Ubuntu

I've been looking for someway to help my in-laws out with their computer for some time now. They have WinXP that was installed several years ago. It really needs to be reinstalled but they don't have any legal way of reinstalling it. While I was pondering their predicament, I read a blog post about Ubuntu. Ubuntu is a Linux-based operating system that focuses on usability. In other words, it is free and easy to use.

I installed it on my desktop to dual boot with my WinXP just to get my feet wet with the OS. The install disk for Ubuntu is actually a live CD and allows you to play with Ubuntu before committing to installing it. The install process was very painless. If you are going to dual boot your system (like I did), I would re-partition your harddrive in the original OS before trying to install Ubuntu (I had a few issues when I tried to get Ubuntu to do it).

The applications and features that come with Ubuntu out of the box would be all that my in-laws would need to replace Windows XP. It also has a very good look and feel that most "simple" users would have no problems getting around in.

Here are some of the things that they constantly use in Windows XP that I have been able to find an equivalent in Ubuntu:
  • Internet Browsing (FireFox)
  • CD/DVD burning (built-in to the file explorer)
  • Pull images off of a camera (built-in to the file explorer)
  • Photo Manager/Editor (FSpot)
  • Microsoft Office (OpenOffice)
Overall, I've been very impressed with Ubuntu. I'm not quite ready to get rid of my WinXP partition yet but I'm more than willing to force my in-laws to go 100% Ubuntu.

Wednesday, November 01, 2006

Dynamic DNS

Dynamic DNS is a very neat tool that let's me have domain name associated with the dynamic ip address that I have with my DSL router (more info here). I've been using the Dynamic DNS service offered by DynDNS.com but they only let you use one of their domain names (they do offer a paid version of their service where you can use your own domain name). I was using their domain name of is-a-geek.com which was a pain to type in and it wasn't my own domain.

A coworker pointed me to a Dynamic DNS service that allows you to use your own domain name for free. The service is ZoneEdit.com. I've been using them for a couple of days and I've been impressed with the amount settings they let you control. Their site isn't the prettiest but they have a lot of functionality open to you. Make sure you get their open source IP Address updater client (more info here).

Wednesday, October 25, 2006

Detecting IE7 in JavaScript

I've tried this method and it works great. This little tip will come in very handy.

Ajaxian � Detecting IE7 in JavaScript: "Detecting IE7 in JavaScript"

Tuesday, October 24, 2006

IE7 and SharePoint

I installed IE7 on Monday to start testing how well the full release of the browser worked with SharePoint. Everything worked great except that I started getting the yellow dropdown box saying:

"This website wants to run the following add-on:'owsclt.dll' from 'Microsoft Corporation'. If you trust the website ...."

You can click and allow the add-on to run but there are quite a few of these add-ons that SharePoint tries to use and it would get old having to click to allow the add-on (or even just hearing the beap and seeing the yellow dropdown gets old quick). A quick fix that I found is that if you trust the owner of the SharePoint site you can add the site to your trusted sites and you'll never see the yellow dropdown box for that site again.

Here are the basic steps to add a site to your trusted sites:
  1. Click Tools menu and then click Internet Options
  2. Click the Security tab
  3. In the 'Select a zone to view or change security settings' box, select Trusted sites
  4. Click the Sites button
  5. In the 'Add this website to the zone:' field, you should see the url for the SharePoint site. If not go ahead and add it to that field.
  6. Click the Add button
  7. Click the Close button
  8. Click the OK button
  9. You're done

Tuesday, October 17, 2006

RegisterClientScriptBlock isn't adding the script to the page

I have a bunch of ASP.NET custom controls that I've written to simpilfy some things that we do all the time (like disable a submit button after a click). To achieve a lot of this functionality, I've written some javascript and had them emitted via the Page.RegisterClientScriptBlock method.

When we converted these controls to ASP.NET 2.0, the script blocks no longer were being written to the page. Luckily I found a blog that mentions that the Register Script calls need to be done in the OnPreRender event because if you it do it in some other event, it will be too late.

Please note that the Page.RegisterClientScriptBlock has been deprecated and replaced by Page.ClientScript.RegisterClientScriptBlock (Thanks to Travis for reminding me to point this out).

Source: Page.RegisterClientScriptBlock isn't adding the script to the page...:

Monday, October 16, 2006

HTML Validation Checking in VS 2005

I'm trying to do some fancy stuff with CSS in my VS 2005 ASP.NET 2.0 web project. Some of the things that I am doing cause my css to not be "Well-Formed". By default VS 2005 validates your CSS and lets you know how crappy of a CSS crafter you are. I finally got tired of it and found this article that tells you how to disable the smarth mouthy validator.

HTML Validation Checking in VS 2005

Theme and Skin Starter Kit

After learning about themes and skins, I wanted to find a some predone themes to give me some ideas to "borrow". Here's one web site that gives you a starter kit.

.NET TREATS & TRICKS :: TOOLS: "ASP.NET 2.0 Colorful Web Site Starter Kit"

Friday, October 13, 2006

Enabling IntelliSense in a Skin file for Visual Studio 2005

We've been going over the new Theme and Skin functionality in ASP.NET 2.0 when I noticed that the IntelliSense was not activiating to help create the skin file. One of my coworkers found the following steps to enable IntelliSense:

  1. Go to Tools->Options menu.
  2. Pick Text Editor -> File Extesion.
  3. Type skin in Extesion text box.
  4. Select User Control Editor from Editor dropdown.
  5. Click Add and then Ok to close dialog and re-open your skin files.

Source: CKCMoss.com: "How to enable intellisense for Skins in 2.0"

Thursday, October 12, 2006

Just learned a handy tip

I just learned that you can click and drag a file or folder from windows explorer on to a command prompt window and it will insert the path to the file/folder into the command prompt prompt. I had no clue that you could do it. Was I the only one in the dark on this one?! Oh well, now I can become even more efficient.

Wednesday, October 11, 2006

VS 2005 and Refactoring

VS 2005 has a new context menu item titled "Refactor". It has all sorts of goodies (check the image below).



I would have given quite a bit of money for any one of these options and now they're all included for "free".

The Rename option changes all references to a property or method (does not just do a find and replace). The coolest option that I saw was the Extract Method option. It allows you to hightlight some code and then it pulls the selected code into a new method and pulls in the needed variables and references.

I am most definately sold on this VS 2005 thing.

VS 2005 and Code Snippets

I love code snippets in Visual Studio 2005. Code snippets are a new feature in VS 2005 that allows you to quickly insert code pieces into your source code. For example, to get a for loop structure: type in for and hit the tab button twice. It will insert the for structure and allow you to quickly change the looping variable's name and loop limit. You can also create your own code snippets or modify your own (located in the C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C# folder)

.NET 2.0 and VS 2005 - Nullable Value Types

We're finally getting some training on .NET 2.0 at work. I'll be posting things that I find interesting in the next couple of days.

One of the first things that I really liked is the ability to have nullable value types. For example, let's say that you have an integer for tracking some value and it can be positive and negative. It is also possible for the value to be not set yet. How do you detect that the value hasn't been set yet? You typically come up with some arbitrary number like 99999999 and hope that the real value is never actually 999999999. In .NET 2.0, they have the ? syntax that allows you to set a value type (ie int, long, struct, etc) to null. For example the following code would not compile in 1.1 but works wonderfully in 2.0:

class MyClass
{
private int? someValue;

public MyClass()
{
someValue = null;
}
public int GetSomeValue()
{
if( someValue != null )
{
return someValue;
}
else
throw new Exception( "Some Value has not been set" );
}
}

This is a much cleaner and safer way than checking for some arbitrary number like 999999999.

Tuesday, October 10, 2006

SharePoint 2007, .NET 2.0 and UserControls

We've been using SmartPart like functionality to load UserControls into our web parts. We are in the process of converting our code to work with SharePoint 2007 (which also includes upgrading the code to .NET 2.0 as well). As some of you might be aware, ASP.NET 2.0 makes use of an _app_bin folder to store compiled code. So I assumed (BIG MISTAKE) that's where the dlls for webparts that load user controls should go. After several days of the webpart not being able to load the user control's dll, I had someone point me to this lovely URL . As you can see, the dll's actually don't go in the _app_bin directory. They still go into the bin directory or GAC.

Saturday, October 07, 2006

SharePoint 2007 Bookmarklets

After beginning a project that uses SharePoint 2007, I tried using my old SharePoint 2003 Bookmarklets, discussed here, and low and behold they still work. These little guys sure have come in handy.

Friday, September 01, 2006

EmigrantDirect.com

I've been an ING Direct customer for over a year. They've been a great online bank and I have no complaints with them. I've always felt that my money was secure and getting a lot better interest in that account than my Credit Union's account.

With that being said, I'm no dummy. When I see another online bank offering an interest 0.8% higher than ING I kind of take notice. My concern with these other online banks is if they offer the same features and is my money safe (obviously not in that order). After hearing about EmigrantDirect.com, first thing I did was google it. EmigrantDirect's interest rate is quite a bit higher than most online banks. Most places say that they have had no problems with EmigrantDirect. So that satisfies my money's security concern.

My second concern is if EmigrantDirect.com offers the same (or even better) features than ING. The main things that I was looking for were:
  • Ease of getting money in and out
  • Time to get at money after money has transferred into account
  • Allow me to have multiple accounts tied to the same login (I use this for helping with budgeting)
  • Automatic or recurring transfers
To try this out, I opened a single account with EmigrantDirect and funded it with $1 (the minimum for opening an account). Setting up the account was pretty painless (which included setting up my account to pull from my Credit Union's checking account). It took about two days for the $1 to show up in my new account. So getting money into the account was pretty easy (√ that one off). I haven't had a need to pull money out but I'm pretty sure that it is just as easy.

During my research, I found one site (can't remember where I found it) that said your money becomes available to transfer again five days after it arrives in your account (same as ING). So this one isn't a factor when comparing the two.

My favorite feature of online banks (besides the higher interest rate of course) is that I can set up multiple accounts and tie them to the one login. This allows me to have several different savings buckets. So I have a savings account for my Christmas fund, my girls' weddings, etc. It works very well for helping the budget. At ING I had about 15 accounts. I only have 4 with EmigrantDirect right now (still in the process of moving everything over) but I see no sign of them limiting my accounts. So one more √.

And last of all, EmigrantDirect.com does allow you to setup recurring transfers to your accounts. It takes about two days after you create a new account for it to become available for any kind of transfers. So √ that one off too.

Overall I'm very pleased with EmigrantDirect.com. Their site does not seem as polished or styled as ING but it offers all the features that I want plus it gives me more money. I definitely recommend EmigrantDirect.com.

Thursday, August 31, 2006

ZOMBOCOM

This is one of the funniest websites. Make sure you stay on the homepage for awhile.

ZOMBOCOM

Tuesday, July 18, 2006

VPN Evolved

A coworker found this very neat app. "It allows VPN functionality in a easy, secure and simple way." Travis.Net.Blog: "VPN Evolved"

The only thing I don't like is that you have to install the client on each end, which might be a problem in a corporate environment.

Wednesday, July 12, 2006

emurse.com - resumes improved

This is a very cool resume site. emurse.com - resumes improved It's very easy to input your information (even lets you import your resume). They have lots of options for sharing your resume with others. This is a very well done website.

Sunday, July 09, 2006

I'm Naturally Cautious

I am a naturally cautious person. I'm always trying to back-up my stuff on my computers to other computers in my network just in case a hard drive fails. I also routinely backup stuff to DVD disks. But I always have in the back of mind, 'What happens if a fire happens'. Of course my data would be on the lower end of my worries but I have some important data that I would like to protect.

Thus enters Mozy. Mozy is a backup utility that stores your data (encrypted) to offsite storage at Mozy's servers. Mozy has a free plan that will allow you to backup up to 2GB of data. They have plans that you can pay for that allow more storage.

I've been using Mozy for several days now and it has been a breeze to get configured and to use. The only annoyance that I have with Mozy is that it currently only supports Windows XP (so my server downstairs is still not protected) but Mozy is only in beta. I'm hoping they'll add Win2003 support in the full 1.0 release.

This is a great tool to add an extra layer of protection to your data. Plus it has the magical word tied to it, FREE.

Wednesday, July 05, 2006

Friday, June 30, 2006

FreeConference.com - Free Telephone Conference Call Service

After researching the vyew.com site that I blogged earlier, I found that the free teleconferencing services that they use is provided by FreeConference.com . They have more advanced options than the one provided by vyew.com. Their middle tiered service (also free) lets you setup security and manage/schedule teleconferences online via web web browser. Could be very handy for distributed teams that don't already have this capability.

Wednesday, June 28, 2006

Vyew. Share your view.

This is probably one of the coolest finds that I've found in awhile. Vyew. Share your view. Vyew is a browser-based conferencing and collaboration tool. They allow you to share viewing of presentations (PowerPoint), files (any you can think of) and even your desktop. You can share a whiteboard and chat. They even provide a phone conferencing number (beware of long distance charges, they don't offer a 1800 number). The best part about vyew is that they're free and always will be free (according to them).

Here are some useful things that you can use vyew for:
  • Share an Office document (PowerPoint slides, Word documents, Excel spreadsheets, etc.)
  • Look and talk about a map (going on a trip?)
  • Load photos from your favorite photo site (ex flikr)
  • Shared Google search
  • Share your desktop
  • Help troubleshoot/train a friend or family member
It's all so cool!!

Update: I just found out that vyew meetings are persistent. Meaning that all your meeting stuff will stay long after your meeting is over. So if you need to review or update your meeting stuff, you can.

Monday, June 26, 2006

Social Networking of a different sort, from Fon | News.blog | CNET News.com

This would be way cool if enough people in Utah used it. I might actually start using once they upgrade their firmware to support the idea of internal wireless users and external wirless users. Social Networking of a different sort, from Fon | News.blog | CNET News.com

Thursday, June 22, 2006

Way Cool

This is a way cool demo that I found. It would be neat to play with but I'm not sure it would be really useful. UI Amazingness at Pixane.net

Best Practices: Using Disposable Windows SharePoint Services Objects

A very good article about memory use of SharePoint objects. Best Practices: Using Disposable Windows SharePoint Services Objects

Monday, June 19, 2006

LITBox nice

I found this cool javascript library for doing in document pop ups. LITBox

Digging a hole to China

Have you ever wondered if you really could dig a whole to China? This mashup will tell you if you need to pack scuba gear or not.

What's on the other side?!

Thursday, June 15, 2006

I love Pixie and that's ok

I've been using a special tool to help me do web design for the last four years. I've never seen anyone else use it so I though I'd introduce it to you, my friends. How do you know that you need this special tool? Have you ever taken a screenshot and pasted it into some kind of photo editor just to get the RGB or HTML HEX code for a color you wanted? Than you need my special tool. The special tool is Nattyware's Pixie.

Pixie is cool because I just have it running in a corner of my screen (it has a very small footprint, check the screenshot below) and it tells me the RGB, HEX, and HTML Hex color codes to reproduce the color that my mouse is currently hovering over. Pressing Control + Alt + C Pixie copies the HTML Hex color code into my clipboard. Pressing Control + Alt + Z will pop up a magnified frozen view of the immediate area around the mouse cursor (handy for getting colors that are only 1 pixel wide).

While Pixie won't revolutionize the way you design, it will save you time and hassle.

.

Wednesday, June 14, 2006

Data Dumper

Travis Haslam moved his blog address to http://datadumper.blogspot.com/ hopefully he can keep it updated better than his last blog.

Tuesday, June 13, 2006

echo for SharePoint?

Has anybody heard of echo for SharePoint from winapp technology? It looks like it might offer some features that our SharePoint app really could use. Please post in the comments your experiences.

ECM Starter Kit released


Microsoft's Enterprise Content Management Team released on Monday the ECM Starter kit. It has sample projects, new records management features, and custom workflows. Very handy resource for those looking to start developing against SharePoint 2007.


http://blogs.msdn.com/ecm/archive/2006/06/12/628398.aspx

Monday, June 12, 2006

Ten Technorati Hacks

I've recently started playing around with Technorati and trying to track my blog's trafic on other blogs. It's kind of fun. I found a blog entry that talks about how to use Technorati to help increase your traffic: Micro Persuasion: Ten Technorati Hacks

Friday, June 09, 2006

Thursday, June 08, 2006

Google Browser Sync

How many times have you wracked your brain trying to remember a url or username/password combo from home that you had setup at work?! I do this all the time. I've even considered writing a little tool to sync browser information like bookmarks and username/passwords, but never found the time to do so. Gratefully I found the Google Browser Sync Firefox extension to ease my poor wracked head.

I have been a Netscape 8 user but it doesn't support this extension. So I have finally come back to Firefox. I now sync my cookies, bookmarks and history between my home laptop, home desktop, work desktop and work laptop. This extension is a must have. Thanks again to Google.

Changed My Blog's Address

I changed the name of my blog. I originally created the blog for recording my ASP.Net and Sharepoint adventures. Over the last several months this blog has turned more into a log of all my technical exploits and findings (And dotnetepiphany.blogspot.com is really hard to remember how to spell). So I think this name and blog address will last me a little longer.

Wednesday, June 07, 2006

CSS Help

I feel I'm pretty good at CSS, but every once in awhile I'll have to fall back on tables because I'm not quite sure how to do some special layout with CSS. I've finally taken the time to start researching the really advanced topics of CSS (like those used on the www.csszengarden.com website). I found a hepful site that has links to lots of tutorials on CSS (going from basic CSS to advanced).

SharePoint 2007 Workflow Overview

I found a very good blog entry on SharePoint 2007 workflow. It explains at a very high level what workflow is in SharePoint 2007.

http://blogs.msdn.com/sharepoint/archive/2006/06/07/621210.aspx

Monday, June 05, 2006

Found a New Blog

I just found a new SharePoint blog that is a good read: http://sharingpoint.blogspot.com/

Thursday, June 01, 2006

Coworkers Are Great!!

Everytime I think, I wish I had a tool that did something or that I should program it, my coworkers show me a free tool that does what I wanted. The newest app that they showed me is a PDF writer called PrimoPDF. PrimoPDF acts like a normal printer but instead of printing to a printer, it saves your print job to a PDF file. While it's not the best PDF writer out there (we use one at work that is more intuitive), it sure has the right price.

My Brother Has Seen The Light

After several months of prodding, I've finally got my brother to create his own blog: http://knighthawkzone.blogspot.com/

PrintScreen App

One of my coworkers showed me a cool little app that replaces the default PrintScreen function. It's called Gadwin PrintScreen. This app is convenient because it allows you to "print screen" a portion of the screen, the current window or the full screen. It also has five tabs full of customizable options. This is a very slick app. Here's the link to the coworker's blog entry about Gadwin:
http://www.ckcmoss.com/blog/archives/6-Gadwin-Printscreen.html

Coworker Blogs

Some of my coworkers have blogs. Some put more effort into it then others

http://weblogs.asp.net/thigley/
http://www.ckcmoss.com/blog/
http://dotnetjunk.blogspot.com/

I Want One!!


I just read on my rss feeds about one of the coolest electronic gadgets ever. A company in the UK has a "PC" called Jack PC that fits into a wall socket. It runs Internet Explorer 6.0 and a cpu that is equivalent to a 1.2GHz86 processor. The unit runs Windows CE but has built-in support to connect to Citrix and Remote Desktop. The Jack PC is so efficient that it runs on Power Over Ethernet(POE). They expect to release the Jack PC for less than $400. They have several configurations, including one that supports analaog and digital video and dual monitors. I would love one of these. Here's a ZDNet review on the Jack PC. I just found the manufacturer's site, they have more propaganda about the Jack PC. I also found how to buy one from Dell here.

Wednesday, May 31, 2006

Two more handy sites

In the same theme as my last post, here are two other handy sites for web designers:

Tuesday, May 30, 2006

Loading Gifs

How many times have you tried finding an animated loading gif for your web application on the web and come away disappointed?! I spent hours the last time and got something that I still wasn't very pleased with. Naturally I found this handy web site several weeks after I had a need for it. I found http://www.AjaxLoad.info. This site allows you to design your very own animated loading gif. You can choose from over 15 indicator types and the fore and background colors. This is a must-have tool for web-app designers.

Thursday, May 25, 2006

Handy Bookmarklet for SharePoint

Some of my projects have forced me into some interesting dilemmas with SharePoint. For example, we are currently replacing the default list item editor web part with a custom list item editor that we wrote in-house. By default, SharePoint does not give the user an option to modify/add/remove web parts on this page. In order to do this, you have to append the querystring &toolpaneview=2 to the url. As with my previous post, it'’s not hard but it can be a tedious chore every time you want to change the configuration of this custom web part.

Thus enters another handy bookmarklet. I have a written bookmarklet that dynamically loads a script tag that points to a js file that I have loaded on my webserver. When this bookmarklet is activated, it highlights web parts with a dotted red border. This allows the user to see what items on a page are web parts. The user can then click on one of the web parts which the bookmarklet will cause the clicked web part to go into edit mode (just as if the 'Modify Shared Webpart' link had been clicked).

This handy little bookmarklet has saved my team and me a ton of extra clicking. It is an awesome little piece of code for making your experience in SharePoint a little bit more enjoyable.

There are two parts that are needed to get this work.
  1. The bookmarklet (only contains javascript to dynamically load the real heavy lifting javascript)
  2. The javascript file that does all the work.

I have the bookmarklet loaded to a publicly available server so feel free to use it. You just need to add the following to a bookmark in your browser:




If you have any suggestions for improvement please let me know and I'll see if I can integrate the improvements.

My Wishlist

I know this isn't a technical post but it will probably help me get technical toys. I don't know about you but throughout the year I can find fun stuff that I would like to own but can't afford (or choose not to afford). As soon as my wife asks me what I want for Christmas or for my birthday, I can't think of a single thing. It's frustrating to the both of us. So I've started using a new service called Wishlistr. It allows me to keep a list of all the cool things that I would like to own. The site is pretty slick too because it uses del.icio.us effects. Another nice feature is that they've created a bookmarklet that can be thrown on your browser that makes it way easy to add something from the web to your list. Give it a looksie.

Thursday, May 04, 2006

Bookmarklets for SharePoint

I've started using bookmarklets to make my life incredibly easier when working with SharePoint. In order to configure webparts on a page, I had to go through several layers of menus. For some configurations, I needed to append querysting parameters to the URL. While these things aren't necessarily time-consuming or difficult, if you do it enough ... it gets old.

I have a bookmarklet that calls the javascript needed to put the Web Part page in the mode that I wanted. Here are a few examples (put the script into the URL field in a shortcut or favorite link):
  • Put the web part page into 'Design' mode
javascript:MSOLayout_ToggleLayoutMode();

  • Put the web part page into 'Browse' mode
javascript:MSOTlPn_ShowToolPane('2');

  • Put the web part page into 'Import' web part mode
javascript:MSOTlPn_ShowToolPane('5');

These shortcuts are great time-savers

Wednesday, February 22, 2006

Sharepoint and AjaxPro

I've been pretty anxious to try and get Ajax working with some of the work that I do in Sharepoint. A couple of days ago I was finally assigned a task that screamed Ajax. Since this is the first project on our server that needed Ajax, I had to do all the setup for it. After downloading the latest dll for AjaxPro, I got started trying to setup it up. Here are the steps you follow

  1. Install the AjaxPro.dll into the GAC or the bin folder (your choice)
  2. Add the Ajax HTTPHandler to each virtual directory's web.config

    <add verb="*" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro, Version=6.7.20.1, Culture=neutral, PublicKeyToken=4735ae9824c7d3ec"></add>
  3. Call the register command
    AjaxPro.Utility.RegisterTypeForAjax(typeof(MyPage), this.Page);
  4. Make a Ajax call with JavaScript

    try
    {
    window.attachEvent("onload", new Function("AjaxUserInfoInit();"));
    }
    catch(ex)
    {
    //Do Nothing
    }


Source: http://www.codeproject.com/Ajax/AjaxNetProExample.asp

So after getting everything configured, I tried loading my SharePoint portal and I started getting security errors for AjaxPro. Apparenty the above blog does not have code access security (or just didn't bother to mention it) setup on his server. For my setup, the best way to get the AjaxPro.dll the permissions it needed was to put it in the GAC (not always the safest way to do things). So after trying to load the portal again, I started getting an error saying that it couldn't locate the AjaxPro.dll. So after some googling, I found an article that mentions that if the dll for an HTTPHandler is in the GAC, the full strongnamed assembly name should be used in the HTTPHandler tag instead of just the assembly file name.

Soure: http://www.codeproject.com/aspnet/exploresessionandcache.asp

Once again I'm trying to load the portal and I get an error about how the AjaxPro assembly does not allow partially trusted callers to access it. So I downloaded the source code, compiled it with a strong name, add the AllowPartiallyTrustedCallersAttribute, redeployed the dll, and voila!!! My portal is once again serving Sharepoint sites. Now I can start writing the code to use the AjaxPro.dll.

Thursday, February 02, 2006

Custom Control

I created a simple web custom control that had a textbox as part of of its control collection. For some reason, the textbox would loses its value after a postback, which I assumed was because the textbox was loosing its viewstate (or couldn't find it). I searched a couple hours before I found INamingContainer. If you add INamingContainer as an interface to your custom control, the textbox will magically be able to maintain its viewstate after each postback.

Wednesday, January 11, 2006

Validation Controls and Webparts

I'm currently working on a project that has a SharePoint webpart with an input form on it. The form has several ASP.NET validator controls on it. The problem begins when I want to modify a webpart's property (not just my webpart) with my webpart on my page. None of the submit buttons work, like 'Ok', 'Apply', 'Cancel', 'Upload', etc. I googled for awhile trying to find a nice easy way to detect that the page was in edit mode but I could not. I found a way to check if my webpart was in edit mode but the problem still would exist if I was editing another webpart or wanted to add another webpart to the page.


So I came up with a custom solution. I wrote a loop routine for all the controls loaded on the Page object and outputted those control IDs. After reviewing the controls loaded on a normal view and edit view of a page, I found that the control named MSOWebPartPage_MenuPostback is loaded to the page only if we are in edit mode. So I wrote a method that recursively searches all the controls loaded to the Page object for MSOWebPartPage_MenuPostback. If the control is found, then I set the validator control's EnableClientScript property to false, otherwise it is set to true. So now the clientside validation is active only when we are not in edit mode. If you do use this technique, you will have to always check that your validator controls validate correctly on the server-side.


Turns out that the above idea wasn't the greatest. Apparently anytime a SharePoint page does a postback, the MSOWebPartpage_MenuPostback control is added. So it does not do an effective job detecting if the page is in edit mode. I however did find the built-in webpart property BrowserDesignMode. This property successfully detects if the page is in edit mode (Modifying a webpart, adding/importing webparts, etc). The rest of the solution works fine with the BrowserDesignMode property replacing the search for the MSOWebPartpage_MenuPostback control.

Friday, January 06, 2006

Handy Tool

A coworker just pointed me to a recently released WinXP power toy. It's called SyncToy. It's nice because you can setup a folder pair (the source and destination folders) and choose the type of synchronization. There are five types of synchronization actions (copied from its own help file):
  • Synchronize: New and updated files are copied both ways. Renames and deletes on either side are repeated on the other.
  • Echo: New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.
  • Subscribe: Updated files on the right are copied to the left if the file name already exists on the left.
  • Contribute: New and updated files are copied left to right. Renames on the left are repeated on the right. No deletions.
  • Combine: New and updated files are copied both ways. Nothing happens to renamed and deleted files.
These allow me to program on my laptop or desktop and keep my files up to date. I also created a shortcut that synchronizes the folder pair that I'm working on the most

"C:\Program Files\Microsoft\SyncToy\SyncToy.exe" -R "SyncPairName"

This will pop open the progress window and it will close again when it's all done syncing. It's a pretty good tool. The only complaint that I have is that there isn't an option to exclude files. It's possible to say that I want only jpg and gif files but not possible to say I want everything but jpg files. Hopefully in the next version...

An XML Serialization Epiphany

I have an object that I want to serialize so that my webapp (SharePoint) can use its properties later. The object (PropertyClass) has a custom collection property that holds objects of BaseClass. Adding the Serialization [Serializable] attribute to each of the class declarations being serialized (ie PropertyClass, CustomCollection, and BaseClass) let me serialize to my heart's content. The problem started when I added a derived class of the BaseClass to the custom collection. Everything would work until the serialization call and then I would get the following error:

The type DerivedClass was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.

After a little googling I found that the problem was that the XMLSerializer did not know how to serialize the derived class. After an hour of googling I found that I needed to add an xml attribute to the BaseClass that tells it how to find the derived classes of the BaseClass. Here’s the xml attribute that I applied to the BaseClass:

[System.Xml.Serialization.XmlInclude(typeof(Class.DerivedClass))]
public class BaseClass
{
...

This seemed to allow me to do normal serialization to a file. However, I needed to serialize this class to custom property of a webpart in SharePoint. SharePoint still choked on the serialization call. After a day of googling I finally found a reference to the XML Schema Definition Tool (xsd.exe). By running the below command I was able to see the xml schema that my serialized PropertyClass would create.

xsd MyProject.dll /t: MyProject.PropertyClass

This command creates an xsd file that has the xml for the schema. After looking at the schema for awhile I found that the schema shows the CustomCollection class as an array. Once this epiphany occurred, I remembered from all the googling that I had already done the XmlArrayItem attribute. I added the following to the get/set property for my CustomCollection in the PropertyClass.

// This attribute enables the Collection to be serialized:
[System.Xml.Serialization.XmlArray( "MyCollection" )]
// Explicitly tell the serializer to expect the derived class so it can be properly written to XML from the collection:
[System.Xml.Serialization.XmlArrayItem( typeof(Class.DerivedClass)) ]
public CustomCollection MyCollection
{
get
{
return myCollection;
}
set
{
myCollection = value;
}
}

And voila, everything serialized beautifully. I have since added several other derived classes to the collection and it works wonderfully as long as you add the appropriate XmlArrayItem and XmlInclude attributes.

My First Post

My main purpose for this blog is to provide a place for me to record my ephiphanies/problems/issues with programming and technology issues. I'm a software engineer that works with .Net andMicrosoft SharePoint, so a lot of my posts will be geared to those subjects but I will have anything that tickles my fancy here as well.