I’ve read many posts related to a request to show a linked Title field. The title can contain a friendly name rather than the actual file name. Often in the libraries I will see CX3000_x3_DiffDeptRpt.pdf rather than Coaxial Cable Differences Report. I like the second better myself and non technical every day users abhor the first. Regularly the answers supplied relate to why you’d even want to make this change. Let’s assume you do. It can be done.

This relates to SharePoint Designer 2007.

First, Create a Standard View from your document library page and make sure Title is among the visible fields. Do not group or Filter.

Open the site in SharePoint Designer 2007 and locate the view you created.

Open in Design view.

Highlight the Main area where the listing shows WebPartPages:ListViewWebPart will show.

Right click and choose Convert to XSLT Data View.

Save.

Still in Design view, look to the top of the listing and click the td where your file name resides.

Click the small right arrow that appears next to a file name. The Common xsl:value-of Tasks dialog shows. It will likely contain Data Field: @LinkFilename with Format as: Text. We’re going to change this.

Click the Data Field drop down and choose @Title.

Click the Format as drop down and choose Hyperlink.

In the Edit Hyperlink dialog, you will see {@Title} in the Text to display area and also in the address area. Click the function (fx) button next to the Address field.

You are presented with the More Fields dialog. Scroll down to URL Path. This equates to the XPath value of @FileRef. There appears to be a bug next. It creates the code for you except it doesn’t quite finish it.

View the page in Split view. Click on the area where the file name is and find the hyperlink a href and fix it to read:

Code:

<a href="{@FileRef}"><xsl:value-of select="@Title" /></a>

Save the page and open the browser. This will place the Title in that spot. Nice.

Not done quite yet…

The next thing you will need to do is assume that somebody will not use Title (whether we should require it is another topic). So, in the code view add the following code.

Note: The first line is the one we just edited, so start at

Code:

<a href="{@FileRef}"><xsl:value-of select="@Title" /></a>
<xsl:choose>
    <xsl:when test="@Title=''">
		<a href="{@FileLeafRef}"><xsl:value-of select="@FileLeafRef" /></a>
	</xsl:when>
    <xsl:otherwise>
	</xsl:otherwise>
</xsl:choose>

Now, edit one of your documents and remove the Title. The real file name should show as it would have before.

Good luck.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

In short, it is a tad painful to brand SharePoint 2010 when using alternate CSS, a custom theme and a custom master page. This is specifically true if you are using the Themable folder. If you are editing your alternate.css file and it is located in the themable folder pay heed to these words.

Drisgill et al. (2010) explain in Professional SharePoint 2010 Branding and User Interface Design - “…make sure that no theme is applied to the site. If a theme is applied to a site that uses the preceding alternate CSS in the Themable directory, the custom background header graphic will not show”.

Of course this tends to be true for all CSS styles and not just background images.

So, set your theme to “no theme” before doing any css development work. If you don’t set to no theme then you can’t click refresh to show the style changes in the browser. The authors do tip you off and tell you to “place the CSS outside of the Themable folder in the Style Library”. That works, but you may want to clean house later or your project may have rules to abide by so here’s the wonky solution as well.

First, set the site to use these settings.

Set your master page to a copy of your custom.master and choose not to enter the alternate CSS path and say OK. Go into site theme and set my theme to Default (no theme) and say OK.

Now go into SharePoint Designer 2010 and check out the Alternate.css file and make your edits. At this time go into the master page settings in my browser and set the css to this file so you can refresh and check changes. Finish your work and then upload a major version.

Now go back into the master page settings within the browser and remove the alternate CSS file entry and click OK. Next, go to site theme and apply the custom theme file (do this first). Then go back to the master page settings and choose your original custom master page for both entries. Finally, enter the path to your alternate CSS file and click OK.

This should show the changed style. If you should want to check what style your page is using, you can use Firebug to view where your changed styles are rendering from. The alternate file will look like Alternate-XXXXXX.css rather than simply Alternate.css. This is why you will need to go to all this trouble to reset the file.

I don’t know if this will help anyone out there, but I was stumped originally when I could see my edits when no theme was applied and then went away when I applied my theme.

Cheers!

References:

Drisgill et al. (2010). Professional SharePoint 2010 Branding and User Interface Design. Indianapolis, IN: Wiley Publishing. Amazon link

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

HTML5 Drawing Tools

The canvas tag for HTML5 is interesting. I’m sure the 31337 ubergeeks want to only write HTML5 in DOS edit, Emacs, Vi or Notepad, but if I am drawing a circle, it is more efficient to just draw the circle. As newer languages emerge - tools follow. I love the ability to edit the code and interact with it when I wish to take advantage of it with jQuery etc. but I want to get the initial shape on the page quickly and then I can edit the code afterwards. So, I want a tool to allow me to simply drag my mouse around and draw my shapes.

Adobe has jumped on board and added “Ai -> Canvas” to their arsenal. This is a plug in for the popular Illustrator program. Of course Illustrator will find itself on the top end as you’d expect for the $600.00 price tag. So, let’s leave that aside for the moment.

There are a few free sites that allow you the ability to simply draw your shape and then export the html page.

CanvasDraw & CanviMation

https://sites.google.com/site/canvasdraw

https://sites.google.com/site/canvimationhelp

HTML5 also supports audio and video out of the box. Again, why write code for an hour when you can use a tool to get the code written efficiently.

Audio and Video

http://westciv.com/tools/audio/
http://westciv.com/tools/video/

Animation

Not free but looks like it has real promise:

http://tumult.com/hype/

Convert Power Point to HTML5

http://download.cnet.com/HTML5Point/3000-2075_4-75665880.html?tag=mncol;6

For more potential tools, check

http://smashinghub.com/10-best-html5-sketching-and-drawing-tools-for-designers.htm

Cheers

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

Large File Upload with C#

I wrote this a few years ago and don’t know why I haven’t posted it, so for those interested in file upload with C#. pay attention to the lMaxFileSize var. I have no doubt this can be improved upon with 4.0

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="up.aspx.cs" Inherits="up.upload" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Upload Script</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
	</HEAD>
	<body MS_POSITIONING="GridLayout" BGCOLOR="lightgrey">
		<form id="upForm" method="post" encType="multipart/form-data" runat="server">
			<INPUT id="File1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 160px" type="file"
				name="File1" runat="server">
			<asp:button id="cmdUpload" style="Z-INDEX: 102; LEFT: 272px; POSITION: absolute; TOP: 160px"
				runat="server" Text="Upload"></asp:button><asp:dropdownlist id="ddlPath" style="Z-INDEX: 103; LEFT: 16px; POSITION: absolute; TOP: 120px" runat="server"
				AutoPostBack="True"></asp:dropdownlist><asp:label id="lblMessage" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 200px"
				runat="server" Width="448px"></asp:label><asp:linkbutton id="LinkButton1" style="Z-INDEX: 105; LEFT: 16px; POSITION: absolute; TOP: 88px"
				runat="server">Reset</asp:linkbutton>
			<asp:Label id="Label1" style="Z-INDEX: 106; LEFT: 24px; POSITION: absolute; TOP: 16px" runat="server"
				Font-Bold="True">Upload Utility</asp:Label>
			<asp:Label id="lblPathMessage" style="Z-INDEX: 107; LEFT: 24px; POSITION: absolute; TOP: 48px"
				runat="server"></asp:Label></form>
	</body>
</HTML>

Now, the details on the codebehind

Code:

'''contents of up.aspx.cs

// contents of up.aspx.cs

namespace up
{
	using System;
	using System.IO;
	using System.Web.UI;
	using System.Web.UI.HtmlControls;
	using System.Web.UI.WebControls;

	public class upload : Page
	{
		protected Button cmdUpload;
		protected DropDownList ddlPath;
		protected HtmlInputFile File1;
		protected Label Label1;
		protected Label lblMessage;
		protected Label lblPathMessage;
		protected LinkButton LinkButton1;
		private long lMaxFileSize = 10485760;
		public static string sFileDir = "";
		public DirectoryInfo[] subDirectories;

		public void BindElement()
		{
			this.ddlPath.DataSource = this.subDirectories;
			this.ddlPath.DataBind();
			this.ddlPath.Items.Insert(0, "select from list");
		}

	private void cmdUpload_Click(object sender, EventArgs e)
		{
			if ((this.File1.PostedFile != null) && (this.File1.PostedFile.ContentLength > 0))
			{
				string fileName = Path.GetFileName(this.File1.PostedFile.FileName);
				try
			{
				if (this.File1.PostedFile.ContentLength <= this.lMaxFileSize)
				{
					this.File1.PostedFile.SaveAs(sFileDir + fileName);
					this.lblMessage.Visible = true;
					this.lblMessage.Text = "File: " + sFileDir + fileName + " Uploaded Successfully";
				}
			else
				{
					this.lblMessage.Visible = true;
					this.lblMessage.Text = "File Size if Over the Limit of " + this.lMaxFileSize;
				}
			}
			catch (Exception)
				{
					this.lblMessage.Visible = true;
					this.lblMessage.Text = "An Error Occured. Please Try Again!";
					this.DeleteFile(sFileDir + fileName);
				}
			}
		}

		private void ddlPath_SelectedIndexChanged(object sender, EventArgs e)
		{
			sFileDir = sFileDir + this.ddlPath.SelectedValue.ToString() + @"\";
			DirectoryInfo info = null;
			info = new DirectoryInfo(sFileDir);
			this.lblPathMessage.Text = "Directory is: " + sFileDir;
			this.subDirectories = info.GetDirectories();
			this.BindElement();
		}

		private void DeleteFile(string strFileName)
		{
			if (strFileName.Trim().Length > 0)
			{
				FileInfo info = new FileInfo(strFileName);
				if (info.Exists)
				{
					info.Delete();
				}
			}
		}

	private void InitializeComponent()
	{
		this.cmdUpload.Click += new EventHandler(this.cmdUpload_Click);
		this.ddlPath.SelectedIndexChanged += new EventHandler(this.ddlPath_SelectedIndexChanged);
		this.LinkButton1.Click += new EventHandler(this.LinkButton1_Click);
		base.Load += new EventHandler(this.Page_Load);
	}

	private void LinkButton1_Click(object sender, EventArgs e)
	{
		this.Reset_Root();
	}

	public void myPath()
	{
		sFileDir = base.Server.MapPath("../");
	}

	protected override void OnInit(EventArgs e)
	{
		this.InitializeComponent();
		base.OnInit(e);
	}

	public void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
		this.Reset_Root();
		}
	}

	public void Reset_Root()
		{
			sFileDir = "";
			this.myPath();
			this.subDirectories = new DirectoryInfo(sFileDir).GetDirectories();
			this.BindElement();
		}
	}
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

This week, I got my hands into IIS7 - yes, I know I am running behind a tad. Since I manage more than I code and administrate these days, it’s a wonder I do any of this. So, I ran into a very simple problem. How do I start IIS7? I don’t want all the pages of explanation and messing about. Just tell me where I turn the key? You think this would be an easy question to answer but I guess not. First, it looks like it is installed - it ain’t. To prove it - open the command prompt (start > run > type cmd); type the following: iisreset
If this gave any kind of an error, chances are you need to add a role to install.

So, without all the geek-speak, here’s how to Start IIS7 for Windows Server 2008 after adding the correct role. BTW, after doing this, it really is a good idea to familiarize yourself here: http://www.iis.net/

  • Right click on Computer and choose Manage or Start - Admin tools - Computer Management
  • Expand Roles under Computer Management
  • Right click on Roles and choose Add a Role
  • Choose Server Roles on the left
  • Choose Web Server (IIS) and follow through to find what ya need

Now, you can stop and start with ease.

  • Look on the left pane under Roles, highlight Web Server (IIS)
  • Now look to the middle bottom pane and highlight IIS Admin Service
  • Finally to the far right, you see Stop, Start, Restart etc.

Or, you could open the command prompt and type iisreset of course. Cheers!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

nVidia GeForce and Vaio Black Screen

OK, I  just had awful trouble getting my Sony Vaio to accept the new nVidia GeForce 6_5 driver.  I searched the internet and found little relief, but I have managed to fix this little bugaboo.  I figured as many help posts as I’ve seen; I’d provide my individual solution.  I don’t know that this will work for everyone, so set a restore point before doing any work.  Also, keep in mind your safe mode if you need to uninstall the driver as I needed to do 6 times in my attempts to get everything working.

My scenario: The kid was playing some online game on my developer station.  I have dual displays set up for this machine.  Everything was fine and I’d obviously made this work a year ago.  To make a long story short, big bad bug attacked my System32 directory and killed the machine for all intense purposes.  It was caught in an endless loop of reboots.  I removed the hard drive and placed it into my Belkin USB enabled enclosure and copied my files to another machine easily.  Next, I placed back in the Vaio and proceeded to reformat and reinstall Windows XP Pro.  No issues with this.  Remember, the nVidia (BFG) card has been in the machine the entire time.  Now, I have rebuilt, I am ready to begin reinstalling drivers and customizing.  I skip past the registration and just get to work.  That may be the problem…

I get most drivers going, except for the nVidia.  What’s it look like?  I install with the disk, but the Vaoi has no obvious way to disable the onboard video.  This is a supposed requirement.  I enter the BIOS with F2, to find there isn’t an obvious way to disable here either.  I try and try to play with the settings, choosing PCI/AGP to no avail.  When I install, and reboot I get a black screen.  I am able to enter Safe mode to uninstall so I can see what I am doing.  Now the refresh rate is crappy again.

In the end, I choose to begin updating the rest of the system.  I verify my copy of Windows and begin updating.  First, I went ahead and installed the driver (without the disk this time) and chose not to restart.  I then updated windows to SP2 and continued.  I then rebooted the system and lo and behold, after choosing my security settings I was able to view and configure the card for dual screens and everything is working as it should.

I don’t know if this will work for everyone, but it may be worth a try.  Let me know if this helps anyone else.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

Recent work

Here are a couple of recent jobs.  If you like what you see, contact me.  Current pricing is reduced.  Sean.Ryan@hireageek.net
Neyland Designs:


The Unger Law Firm:

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

msxml3.dll error ‘80070005′

This little error is causing some trouble for developers, particularly those in charge of maintaining legacy code in VB and vbscript. The trouble has stemmed from a recent microsoft service pack: Microsoft Security Bulletin MS07-042 - Critical (Vulnerability in Microsoft XML Core Services Could Allow Remote Code Execution (936227))

I have seen this everywhere on my travels across Google. People are trying all kinds of things to fix the error in the title. It may also manifest itself as msxml2.dll error ‘80070005′ Access Denied. There was a critical patch needed to secure things further, so it’s a good thing to take care of. That doesn’t take care of the headache.

So, to the code.

Should you have something similar to:

Set xml = Server.CreateObject("Microsoft.XMLHTTP")

Replace it with something like:

Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")

I hope this helps.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

Batch files aren’t dead yet

OK, I can hear the Powershell, WSH, Ruby, Perl and other such fans geeking out already, but the truth is the command line shell DOS isn’t a dead horse yet. It still provides some very friendly ways of performing automated tasks. I have put together a group of bat files that perform weblog backups. You could use these files to perform other kinds of backups if needed. Also for those out there who still like to play in DOS, there are a few neat little tidbits within the group of files. I don’t usually place code in my entries, but this worked well, and I figured out much of it by perusing the web and getting some bits from here and there to perfect the toolset. So, thanks everyone.

Now, to use these bat files you will need two utilities. The first is a little add-on for the command line called doff which makes formatting dates very easy. You can find this at http://www.jfitz.com/dos/. Just copy this file into Windows\System32. You don’t need to run a regsvr on this either. Next, because it is rather commonplace, I chose to use winzip for the zipping portion of the action set. You could easily change this to pkzip or some other compression utility that has a command line option.

OK, if you have all that set up - you can begin. The next piece I will share is that you’ll need to check your logfile nomenclature. In this example I am pulling hourly logs based on the previous day. So, I download logs that look like ex07082300.log, ex07082301 and so on. The common element is the 23 in this case. So, today is the 24th and I want to download yesterdays logs into a date created directory with the name of the day as the name of the zip archive. Make sense?. There are four files in this example, because I like to separate functionality in my code rather than putting it all in one.

Once you copy these files you can run it on a schedule. To do this you can run schtasks in XP and higher (start > run > type cmd > type schtasks /?) or AT in previous versions (type AT /?). The file you want to schedule is localBackup.bat.

Click here or right click-save link as… to get the zipped folder with all the contents. There are six files in the toolset, but the two script files are recreated on the fly from a called bat file each time it is run. They are there to share the example. To conclude, please test this and let me know if there are any date based bugs. I haven’t run this on the first of the month or last day of a month yet. As with all code from the web, please use at your own risk and feel free to modify and share as you like.

Update: The files worked on the first day of the month.  It downloaded the last day of the previous month as needed.  This has yet to break on me, so there it is…

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon

Broken link management

Recently I was assigned a task to run through a specific dataset and determine all broken or outdated links within a database. I didn’t really want to write a specific 404 script so I improvised. I created a web form not long ago that would produce an asp page that pulls data from a variable entered data source and driver. Based on entry it will include a specific driver and a dataset location. In this instance I was working with a Foxpro source. In a matter of seconds I had a page that would dump all links to a single page. This also helps my reporting. Next, I jumped out to download.com to see what I could find to help me read the page I had generated. I found a nice little tool called Xenu http://home.snafu.de/tilman/xenulink.html. I downloaded and installed the tool and ran the tool against the new page locally.

The tool ran through the page and showcased all links that were broken; either not found, redirected, no such host, etc. Cool! Next, Xenu allowed me to export the data to a delimited file, and I imported that into a new Fox table I could query against. I pulled together a decent report and handed this off to an admin cleanup crew. Out of over 1,400 links, 250 or so showed results other than success.

The next step is to figure out how to take this new dataset and run a compare. Within this I want a condition that states, if the link is broken, then send to archive table and delete from current.

Of course, the best way to perform this kind of work is to automate the entire process, but in all – this took about 30 minutes. It was enough for what I needed to get done right away. If I have time to get to automation and make it work I will share the method. If anyone else has such an automated link management methodology for databases, feel free to share.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Slashdot
  • Furl
  • StumbleUpon