Tuesday, December 15, 2009

TFS Error: HTTP code 403: TF53011: DOMAIN\USER is not a licensed user.

While adding a new user to the TFS I got the following error:
HTTP code 403: TF53011: DOMAIN\USER is not a licensed user.

There are many talks in the web, but the solution might be VERY simple (it was in my case):
Add the new user to the TFS group "Team Foundation Licensed Users Group":
- In the 'Team Explorer', right click on the TFS Server -> Team Project Settings -> Group Membership
- Add the new user to the following group:
[SERVER]\Team Foundation Licensed Users Group

Sunday, November 22, 2009

Scheduled Task fails: Could not start

I just got a new machine for a customer and started to set it up. I've defined multiple scheduled tasks, and I got: "Could not start" error for one of the tasks... That specific task was a batch job.

I've found few resources on the web and solved the problem. I would recommend the following protocol for such an error:
*. Check the log file of the scheduled tasks: open the scheduled tasks in explorer window and select "Advanced"->"View Log".

Option 1:
*. Check the following policy: Control Panel|Admin Tools|Local Security Policy\Local Policies\User Rights Assignments "Log on as a batch job" (also - someone wrote that his problem was that there was a group policy overriding the local computer policy).

Option 2:
If the error is:
0x80070005: Access is denied.
Try using the Task page Browse button to locate the application.

Try resolving it using the protocol defined here:
*. Check the user you are trying to run as can run the script:
---- Start - Run - RunAs /user:username@domain (Your Command)
*. If it doesn't run, try giving the user privileges:
Cacls c:\windows\system32\cmd.exe /e /g username@domain:r

Tuesday, October 27, 2009

Open a new browser tab from ASP.NET control

To open a new browser tab from ASP.NET control client side scripting must be used (not ASP.NET OnClick). There are few answers on the web how to do that. Some don't work & some are incomplete. The following works with any browser version I've checked:

button.Attributes.Add("onclick", "javascript: window.open('your_url','',''); return false;");

This add a client side event handler "onclick", which overrides the ASP.NET OnClick event. If you put both ASP.NET OnClick event handler & this "onlick" client side handler, only the client side will be executed. You may choose if to add the client side handler at run-time.

Saturday, September 5, 2009

Configuring Option GlobeSurfer II

For some reason it's hard to find some configurations in this router, here goes for what I needed:
Port Forwarding: Connection Settings -> Security -> Port Forwarding
Static Addresses: Advanced -> IP Address Distribution -> Connection List

Wednesday, August 26, 2009

SharePoint writes 'Unknown Error'

The following post was very helpful:
http://koenvosters.wordpress.com/2009/08/06/showing-the-real-error-message-in-sharepoint/ - It Shows how to set the IIS to display the full stack trace.

Monday, August 24, 2009

ASP.NET Error: The resource cannot be found

Check the following:

1. Check that the target resource exists.

2. Check that ASP.NET is enabled on the IIS:
A. Open: Administrative Tools => Internet Information Service (IIS) Manager
B. Expand the server, click on 'Web Service Extension'
C. Verify that ASP.NET is set as 'Allowed'. If not, change it.

Sunday, August 16, 2009

Using multiple JavaScript libraries (Prototype, MooTools, jQuery)

I'm a fan of MooTools (a JavaScript library), and most of the tools I use are based on this library. That said, one of the best JS around is LightBox, which is based on Prototype. However, when I tried using both MooTools & Prototype libraries in the same webpage it failed. I was sure there's a solution so I kept digging in, but I couldn't find any.

Another JS library - jQuery has a special computability function called noConflict which solves those problems, but both MooTools & Prototype lack that functionality.

The only solution I could find: Choose one library - MooTools or Prototype, and use only that library. There are similar implementation of most tools in both libraries.

Sunday, July 19, 2009

Cannot resolve the collation conflict between XXXXXXX and YYYYYYYYY in the equal to operation

This error indicated that the strings in the join operation are from fields created in different collation. In general, it's better to recreate the fields with the same collation definition, but if you're just too lazy, and want to get things done, just cast to problematic field (in this example it's to 'SQL_Latin1_General_CP1_CI_AS'):

SELECT *
FROM A, B
WHERE A.F1 = B.F1 COLLATE SQL_Latin1_General_CP1_CI_AS

Monday, July 13, 2009

WordPress & GoDaddy Windows shared hosting

Wordpress works just fine in GoDaddy shared Windows hosting (IIS7), however when trying to install a plugin I get:

Downloading install package from http://downloads.wordpress.org/plugin/XXXXXX.zip.

Warning: touch() [function.touch]: Unable to create file D:\Hosting\XXXXX\html\XXXXXX.com\blog/wp-content/XXXXXX.zip because Permission denied in D:\Hosting\2804923\html\spassets.com\blog\wp-admin\includes\file.php on line 175

Download failed. Could not create Temporary file

Solution: since no solution can be found on the web, I used the good old method - manual install:
* Download the package from wordpress
* Uncompress and upload to /wp-content/plugins (I just copied from another wordpress I have).

And it works!

Sunday, July 12, 2009

Web.config & GoDaddy.com

I wrote a small ASP.NET application, which needed to read the web.config file. To open the Web.config file I used 'OpenWebConfiguration':
WebConfigurationManager.OpenWebConfiguration(...)

Since GoDaddy uses medium trust, I kept on getting:
'The application attempted to perform an operation not allowed by the security policy'

And in the detailed:
'System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

The resolution - use ConfigurationManager.ConnectionStrings instead.

Monday, June 29, 2009

Pre-selecting items from CheckBoxList

I'm not much of an ASP.NET guy, but from time to time I've got to write some simple ASP.NET pages.

I've tried to use data-bound CheckBoxList (data binding done with the built-in wizard), and update the data with some pre-selected values. For some reason CheckBoxList Items are not populated when Page_Load function is called, so the list can't be updated.

Solution A: Found it on Google, but should have thought about it myself - just remove the data-binding done with the VS wizard, and do all the data handling in code.

Solution B (better): Call 'DataBind()' before pre-selecting the CheckBoxList items.

Weird. I must be missing something here. Anyway - it's working.

Tuesday, June 23, 2009

Generics Dictionary<> clone

Here's a simple routine that will clone generic Dictionary:


public static Dictionary<S, V> Clone<S,V>(Dictionary<S, V> dictionary)
{
Dictionary<S, V> cloneDictionary = new Dictionary<S, V>();
foreach (KeyValuePair<S, V> kvp in dictionary)
cloneDictionary.Add(kvp.Key, kvp.Value);

return cloneDictionary;
}

Wednesday, May 20, 2009

SharePoint Web-part dev problem - List does not exist

Problem:
I was working on a web-part with a custom ASPX file. It was working just fine for the root site of a site collection, but when testing it on a subsite it failed to load the ASPX file with the following exception:

List does not exist

The page you selected contains a list that does not exist. It may have been deleted by another user.

Solution:
There are few suggestions that didn't help me on the web. With the good old method - remove everything and check what's making the problem I found the perpetrator: in the ASPX page, I used SharePoint:FormattedStringWithListType, which caused the exception.

Using reflector I found that FormattedStringWithListType has a property 'List' which opens SPList with the current SPWeb context (list GUID is taken from the request parameter named 'List'). At this point I noticed that when the ASPX file is opened, it is done from the site collection level & not the sub site level.

From here there are few possible solutions:
*. Open the ASPX file from the subsite level (probably the best solution).
*. Don't use the class FormattedStringWithListType
*. Copy with reflector & fix the problem using SPSite.

Saturday, March 28, 2009

Response.Header.Add doesn't work

I've tried to use:
Response.Header.Add("HeaderKeyName", "KeyValue")

But I got the following exception:
System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
at System.Web.HttpResponse.get_Headers()

The work around:
Response.AddHeader("HeaderKeyName", "KeyValue")

For the least Microsoft could find a better exception description.

Tuesday, March 24, 2009

HyperLinkField not showing as link (ASP.NET)

After binding data to a HyperLinkField in a GridView it didn't show as link but as a normal text. Apparently when using navigation by data fields, the data in the fields set in DataNavigateUrlFields must be validated.

See some more information here:
http://stackoverflow.com/questions/640120/hyperlinkfield-not-showing-as-link

I had a problem when the field was a DateTime field returned by a database query. I've change the field format in the following way to make this work (navigation):
[Date] = convert(VARCHAR, [Date],104)

Tuesday, March 10, 2009

You are not authorized to view this page

Symptoms:

One clear morning, on an operational system (Windows 2003 x64, IIS, ASP.NET, SQL Server 2005) running an ASP.NET application, the users started to get request to fill their credentials, and after few times they got:
You are not authorized to view this page

With more specific notification:
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.Internet Information Services (IIS)

In the event log of the server I found the following errors:
- System Events - I found warning event 1011 titled "W3SVC":
A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the World Wide Web Publishing Service. The process id was '6756'. The data field contains the error number.

- Application Events - I found error event 1000 titled ".NET Runtime 2.0 Error Reporting":
Faulting application w3wp.exe, version 6.0.3790.3959, stamp 45d691cc, faulting module kernel32.dll, version 5.2.3790.4062, stamp 462643a7, debug? 0, fault address 0x0000000000027d8d.

Resolution:

I followed few wrong leads on the web, such as:

After wasting nearly a day a found the root cause:
The ASP.NET application had a stack-overflow bug.

From here fixing is easy.

The reason that I didn't suspected the ASP.NET application was that the stack-overflow bug was caused by a run time change of the data in the application, and not something new installed/configured.

Monday, January 26, 2009

How to check if the Laptop IR (Infrared) is working

This is really cool - open your Cellular phone camera and point it to the laptop IR sensor. The sensor will blink every 3-4 seconds on the cellular camera screen.

I've been told it also works with remote controls (so you can check the batteries), and I can only guess it's working with any digital camera.

Sunday, January 25, 2009

Windows XP drivers for laptops

As I wrote before I've got HP dv6700 which I've installed win2003 on. Few days ago I've finished the project for which I needed that OS, and I've started to install WinXP on this machine. As I found out HP doesn't really says which drivers I should use for Windows XP. I've tried installing drivers similar to the ones they say for Vista (only WinXP version of them) and they didn't realy want to install...

Anyway, I started to get somewhere only after installing SiSoftware Sandra. An amazing piece of software that just finds out exactly what kind of hardware you got. With this software I found out in minutes which drivers I should use.

Thursday, January 8, 2009

WebPart wsp does not include dependent DLLs

I was trying to develop a webpart for SharePoint 2007 & WSS3 using Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1.

Everything worked just fine, until I found out that the WSP file created by the add-on does not include dependent DLLs (from other projects in the solution). I could not find any good solution, so finally I had the following options:

1. In post-build event, use ILMerge to merge all the DLLs into a single DLL with the name & key file of the webpart, and replace existing DLL with this new merged DLL.

2. Add the dependent DLL to the project files of the webpart. This way the WSP file includes the dependent DLL. An improvement: add the DLL file in the following directory: bin/Release/ (change the project file with notepad) - this way any new compilation will include the new DLL.

3. Probably the best option - use a 3rd party tool to create the WSP file - WSPBuilder for example.