Wednesday, 27 July 2011

Display / Show PDF icon in Sharepoint / MOSS

  1. Copy the .gif file that you want to use for the icon to the following folder on the server, as appropriate for your version of SharePoint:
    SharePoint Portal Server 2003 - Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\Images
    SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Image
    SharePoint Server 2010 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Images
  2. Stop IIS at a command prompt by running IISReset /stop
  3. Edit the Docicon.xml file to include the .pdf extension. To do this, follow these steps:
    1. Start Notepad, and then open the Docicon.xml file. The Docicon.xml file is located in one of the following folders on the server:
      SharePoint Portal Server 2003 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\Template\Xml
      SharePoint Server 2007- Drive :\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml
      SharePoint Server 2010- Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Xml
    2. Add an entry for the .pdf extension. For example, add a line that is similar to the following to the Docicon.xml file, where NameofIconFile is the name of the .gif file:
      <Mapping Key="pdf" Value="NameofIconFile.gif"/>
    3. On the File menu, click Save, and then quit Notepad.
  4. Start IIS at a command prompt by running IISReset /start

Thursday, 21 July 2011

Calculate Working days in a Month

Dim stDate As Date = New Date(Year(dtDate), Month(dtDate), 1)
Dim enDate As Date = New Date(Year(stDate), Month(stDate), DateTime.DaysInMonth(Year(stDate), Month(stDate)))
While stDate < enDate
    If stDate.DayOfWeek <> DayOfWeek.Saturday AndAlso stDate.DayOfWeek <> DayOfWeek.Sunday Then
        intReturnValue += 1
    End If
    stDate = stDate.AddDays(1)
End While
Return intReturnValue

Wednesday, 20 July 2011

How to create threads with .net and Azure Web Role

Dim t As New Threading.Thread(AddressOf ThreadTask)
t.IsBackground = True
t.Start()

and then create your ThreadTask

Private Sub ThreadTask()
'do your routine here
End Sub

Monday, 18 July 2011

Best way to Zoom map to include all Pushpins

add the following to your map function

var locs = new Array();
/* Repeat the next 2 lines of code as neccessary */
var loc = new VELatLong(<latitude>, <longitude>);
locs.push(loc);
/* End Repeat */
map.SetMapView(locs);

Writing to Azure Local Storage

You will need to modify ServiceDefinition.csdef add the following lines

<LocalResources>
<LocalStorage name="LocalTempFolder" cleanOnRoleRecycle="false" sizeInMB="5" />
</LocalResources>

and then you can access the path this way in your code

Dim localResource As LocalResource = RoleEnvironment.GetLocalResource("LocalTempFolder")
Dim pathToReadWriteFolder = localResource.RootPath

Thursday, 14 July 2011

Check if SQL View Exist

IF OBJECT_ID ('_YOUR_VIEW_NAME', 'V') IS NOT NULL DROP VIEW _YOUR_VIEW_NAME';

Wednesday, 13 July 2011

Javascript Popup window causes parent font size increase?

If you are usnig Javascript popup window and its disturbing your parent font sizes use the ScriptManager.RegisterStartupScript instead.

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "newWindow", "window.open('MyPage.aspx?ID=" + MyID + "','_blank','status=1,toolbar=0,menubar=0,location=1,scrollbars=1,resizable=1,width=30,height=30');", true);