Learn IT

Free learning anything to everything in Information Technology.

Disable Right Click On SharePoint Site

Follow these steps to prevent users from right-clicking in your sharepoint site.

  • Add a content editor web .
  • Add the following piece of code in the source editor of the content editor web part.

<HTML>
<BODY OnContextMenu = "return false;">
No Right Click on this Page.
</BODY>
</HTML>

  • Save the content editor web part.

Users are now prevented from the right click option on the page.

Reconnecting Content Databases in MOSS 2007

After the failover of a SharePoint Products and technologies database, it is required to reconnect the content databases. The following are the databases that are required to be reconnected,
  • Content database
  • Admin database
  • Configuration Database
  • Search Database
  • Shared Services Provider

The following stsadm commands are used to reconnect to the content database after a failover, the deletecontentdb will remove the reference to the old database server and the addcontentdb will add the new database as the content database

stsadm –o deletecontentdb –url [Site] -databasename -databaseserver [Old Principal]

stsadm –o addcontentdb –url [Site] -databasename -databaseserver [Old Principal]

Reconnecting content databases can also be done using Central Administration,

  1. Navigate to Central Administration.
  2. Navigate to Application management page
  3. Click on the Content Databases.
  4. Select the content database that has failed-over.
  5. In the Manage Content Databases page, choose the Remove content database option, and then click OK.
  6. Select the Add a content database option, and enter the required details.
  7. Replace the Database Server box with the new principal server, and then click OK.

Globalization In .NET

Globalization refers to the process with which an application or software will be designed and developed so as to make it run across all platforms and all sites with minimum or no modification to the software application. The software is very amenable to customisation so as to suit to the location-specific conditions and it is also capable of providing information based on the varied inputs and the location-specific operating system.Under any normal circumstance, there will be two processes in Globalization and they are customisation or localisation of the application and internationalizing the application codes so as to meet the standards of the local culture and other related matters.

In internationalization process the application code base will be same and the efforts will be on jobs such as translating, storing, retrieving and to make the application user friendly for the selected locale. In any given place the culture and the language will always be different and besides this you should also take into account the other factors such as time zone, normal date pattern usage, cultural and language environments, currencies, telephone numbers, and so many other factors that are specific to the locale.

In globalization the process of internationalization enables you to remove from the code base and the presentation layer all the contents and make you to use only a single presentation layer and single code base with a common contents that can suit any culture. The internationalization process will aid you to keep all the contents in a common place with an idea of making it easily accessible by the programme codes and the results can easily be populated all over presentation layer and the application with ease and efficiently.

In addition to the above, the internationalization process also enables you to store the contents and all the collected inputs from the user in a user friendly format and in a highly secured manner without compromising any standards pertaining to the local culture. The internationalization process is one step before any attempt for localising the application to suit to the local needs.

With the help of the localization process of globalization, you can make your application adaptable to the various location specific conditions and it will be easy for you to translate and re-format your application to suit to your new location and that too without changing any of the codes. Further, you can make use of the process for rectifying any of the reported bugs and for fine tuning the application for running smoothly without any hitch.

The globalization process also makes use of the locally prevailing information on culture where the software or the application is to be installed and maintained. The locational details and the language used in that particular area constitute to culture information and for working with any culture based information the namespace concept is utilised and the System.Globalization, System.Resources and System.Threading are the available namespaces in .NET Framework.

Out of the various namespaces, the System.Globalization namespace constitute classes that are used to hold information relating to region or country, the local language used, type of calendars, date format used, numbers, currency, etc., all in a meticulously arranged fashion and all these classes are used while developing the globalized (internationalized) applications.

You can use advanced globalization functionalities with the assistance of classes such as StringInfo and TextInfo classes and the various functionalities include text element processing and surrogate support systems.

The System.Resources namespace constitutes interfaces and classes that are very helpful for developers and maintenance experts in creating, storing, retrieving, and managing various resources used in the application that are culture and location-specific.

The System.Threading namespace constitutes interfaces and classes that aid in multithreaded programming. The classes that are used in this type of SystemThreading namespace are also useful in accessing data and for synchronization of thread activities.

Pros & Cons: Custom Templates and Site Definitions

Customization of site definitions holds the following advantages over custom templates:

  • Data is stored directly on the Web servers, so performance is typically better.
  • A higher level of list customization is possible through direct editing of a SCHEMA.XML file.
  • Certain kinds of customization to sites or lists require use of site definitions, such as introducing new file types, defining view styles, or modifying the drop-down Edit menu.

Site definition disadvantages include the following:

  • Customization of site definition requires more effort than creating custom templates.
  • It is difficult to edit a site definition after it has been deployed.
  • Doing anything other than adding code can break existing sites.
  • Users cannot apply a SharePoint theme through a site definition.
  • Users cannot create two lists of the same type with different default content.
  • Customizing site definitions requires access to the file system of the front-end Web server.

Custom templates hold the following advantages over customization of site definitions:

  • Custom templates are easy to create.
  • Almost anything that can be done in the user interface can be preserved in the template.
  • Custom templates can be modified without affecting existing sites that have been created from the templates.
  • Custom templates are easy to deploy.

Custom template disadvantages include the following:

  • Custom templates are not created in a development environment.
  • They are less efficient in large-scale environments.
  • If the site definition on which the custom template is based does not exist on the front-end server or servers, the custom template will not work.

Difference Between MOSS 2007 and WSS 3.0

It always astounds me what Microsoft are willing to bundle with their software, Analysis Services or SSIS (SQL Server Integration Services) with SQL Server for example! They haven't stopped, they bundle Windows Sharepoint Services with Windows Server 2003, with is basically a fully functional SharePoint Server, however they still have SharePoint Server 2007 as a product. So what are the differences? At first glance it doesn't appear to be much, however for tight integration into the enterprise, it seems that MOSS 2007 (Microsoft Office SharePoint Server) is a must! I will highlight the most interesting bits that MOSS 2007 has over and above WSS 3.0 (Windows Sharepoint Services) :
  • User Profiles support - Allows each user to store profile information

  • Site Manager - Manage Navigation, Security and look and feel with drag an drop functionality

  • Enterprise Search Tools - numerous tools to search Sharepoint Sites and Portals across entire enterprises

  • Business Data Catalog - The Business Data Catalog (BDC) tightly integrates external data, providing access to external data residing within other business applications, and enabling the display of, and interaction with external data

  • Business data search - Search data residing in your business applications using the BDC

  • Business Data Web Parts - Used for viewing lists, entities, and related information retrieved through the Business Data Catalog

  • Business document workflow support - Automate document review, approval, signature collection, and issue tracking using workflow applications

  • Retention and auditing policies - Allows customized information management policies to control retention period, expiration, and auditing

  • Browser-based forms - Integration with InfoPath, allows integration on to SharePoint of created forms and surveys.

  • Integrated, flexible spreadsheet publishing - Allows information workers to easily choose what they want to share with others and determine how others can interact with published spreadsheets.

  • Share, manage, and control spreadsheets - Provides access to spreadsheet data and analysis through server-calculated, interactive spreadsheets from a Web browser. Can help to protect any sensitive or proprietary information embedded in documents, such as financial models, and audits their usage.

  • Web-based business intelligence using Excel Services - Allows spreadsheets to be broadly and easily shared. Fully interactive, data-bound spreadsheets including charts, tables, and PivotTable views can be created as part of a portal, dashboard, or business scorecard.

  • Data Connection Libraries - Document Libraries storing ODCs (Office Data Connections), Making one single location for all data connections.

  • Business Data actions - Easily create actions that open Web pages, display the user interfaces of other business applications, launch InfoPath forms, and perform other common tasks.

  • Integrated business intelligence dashboards - Rich, interactive BI dashboards that assemble and display business information from disparate sources by using built-in Web parts, Excel spreadsheets, Reporting Services, or a collection of business data connectivity Web Parts.

  • Report Center - Provides consistent management of reports, spreadsheets, and data connections.

  • Key performance indicators - A KPI web Part can connect to Analysis Services, Excel Spreadsheets, SharePoint Lists, or manual entered data.

  • Notification service - Improved allowing workflow users to receive emails by default, and improved triggering and filtering

  • Single Sign-On (SSO) - Allows the User to log onto a variety of applications with a single user name and password, therefore integrating back office applications, and helps pre-population with integration to the Profile part of MOSS 2007.

  • Social Networking Part - Connect to Public My Site pages to help establish connections between colleagues with common interests

  • Personal Site Support - Allows Users to create Personal Web Sites

  • Content syndication - Use RSS feeds to syndicate content managed in a portal site.

Create an IE Favorite to quickly resize your browser

Often times when editing or designing a web page or a site I use my full screen to take advantage of all the realestate my screen has to offer. I also often times need to quickly see what a page will look like in a smaller screen resolution such as 1024x768.
Here is a quick tip to quickly and easily resize your IE browser to a specific size.

  • Create a shortcut in your IE Favorites or in you Links folder.

  • Rename this shortcut/favorite to "Resize Window to 1024x768".

  • Edit the properties of the shortcut and place the following line of javascript in the URL property.
    javascript:window.resizeTo(1024,768)
    Note: You will receive a warning prompt. Simply proceed.

  • Save the properties and then click your new favorite Resize Window to 1024x768.

Your current window should now automatically resize to 1024x768. You can change this to 800x600 or whatever size you need.

Apply a Theme to all sub sites in SharePoint 2007

Apply a Theme to all sub sites:(works for MOSS 2007 only, not WSS 3.0)

  • Change the top site to the theme of your choice using the normal method in Site Actions > Site Settings > Site Theme.

  • Navigate to the top site to see the newly applied theme.

  • View the HTML source of the SharePoint page using the theme you want.

  • Look for a link tag containing the .css file for the applied theme. It will look something like this:

<link rel="stylesheet" type="text/css" id="onetidThemeCSS" href="/apps/afe/_themes/Belltown/Bell1011-65001.css?rev=12%2E0%2E0%2E4518"/>

  • Copy the href value to your clipboard or to a text file if you like. It should look something like:/apps/afe/_themes/Belltown/Bell1011-65001.css

  • On your top level site, go to the Site Actions > Site Settings > Master Page screen. Scroll to the bottom where the Alternate CSS URL section is. Select the "Specify a CSS file..." option.

  • Paste the path copied from the href above into the text box.

  • Check the Reset all sub-sites to inherit this alternate CSS URL option.

  • Click OK.

  • Navigate to your sub-sites and verify the theme has been applied.

We Developers Do the Dumbest Things

Ever do something really stupid in your code? I bet you can't say "No" with a straight face. But, don't you get irritated when you encounter someone else's blunders. I have found some real dillys lately and thought I might run them by anyone that ever reads my blog, which at this point is not a lot of people.

It seems that a lot of self-named .NET developers totally don't understand Exception Handling!

For example, explain the need for the following Try Catch block, if you can.

private void DoNothing()
{ try
{
// do some code
}
catch(Exception ex)
{
throw(ex);
}
}

Did it never occur to the writer of this code that if they had not coded the try catch, that the results of a failure in the DoNothing method will be exactly the same. The try catch as coded basically is an unhandled exception, which could have been raised without the try catch.

Here's one more that completely baffled me when I came upon it recently.

Try
IO.File.Move(oldPath, newPath)
Catch (ex As Exception)
IO.File.Move(oldPath, newPath)
End Try

Go Figure! What is this? "If at first you don't succeed, Try, Try again?"

Take a minute and comment with something really dumb that you have done or seen.

Send a Message to Everyone Logged into a SQL Server

If you've done any heavy lifting in Database programming, you quickly notice that languages like T-SQL and PL/SQL can do quite a bit for you. While SQL certainly is powerful, it doesn't have many constructs that are a given in more modern programming languages. Additionally, cursors can do a lot for you, but they aren't fast and ADO.NET doesn't play really well with them.

Anyway, in this snippet, I'm going to use a While Loop in T-SQL, dynamically create some SQL commands, and fire them off via xp_cmdshell. Think about it for a second, if you did this some other way, it would take a good amount of work to fire off Net Send Messages to everyone logged into your database (and would be next to impossible with a non Client/Server database like Access). Well, this is pretty straightforward, you just query SYSPROCESSES, construct a SQL Statement, execute it, then requery SYSPROCESSES.

Check out the snippet below:

CREATE PROC usp_notify_users @notification VARCHAR(100)
AS

BEGIN
SET NOCOUNT ON

DECLARE @Command VARCHAR(300)
DECLARE @hostname SYSNAME

SELECT @hostname= MIN(RTRIM(hostname)) FROM master.dbo.sysprocesses
(NOLOCK) WHERE hostname <> ''

WHILE @hostname is not null
BEGIN
SET @Command='exec master.dbo.xp_cmdshell "net send ' + RTRIM(@hostname) + ' ' + RTRIM(@notification) + ' "'
EXEC (@Command)

SELECT @hostname= MIN(RTRIM(hostname)) FROM master.dbo.sysprocesses (NOLOCK) WHERE hostname <> '' and hostname > @hostname

END

SET NOCOUNT OFF
END


This proc takes in a Param @Notification which is what you want to broadcast to everyone. We declare another variable, @Command which is going to be used so we can dynamically build a T-SQL Statement and fire a command via xp_cmdshell.. Then we reset the values each pass through a while loop and NET SEND a message each pass through.

Five Secrets Of Successful Requirement Gathering

Introduction

Although most companies do some form of requirements, there is often a lack of understanding as to exactly why the requirements need to be created and the level of detail that should be included in the requirements.

Software is always created to solve a need for a client. The client may be an internal client, an external client, or even the general public. Detailed requirements are important to ensure that a program correctly and fully addresses client's needs.

Detailed requirements make initial development easier and faster because the developers know exactly what should be developed and do not need to make their best guess at the functionality to be implemented or delay development by creating requirements during development. Giving the developers accurate requirements will also result in less rework at the end of development because the stakeholder's requirements will have been implemented correctly initially and will not be arrived at through trial and error.

A project manager can use the detailed requirements to create accurate timelines and give correct estimates to the client. This ensures that stakeholders are completely aware how long development will take so they can adjust the scope of a project or proactively add resources if necessary.

Finally, testers can use the requirements to create test plans while development is ongoing rather than waiting until development is complete. The requirements give them information about what the program will do so there cannot be disputes between developers and testers as to what the program functionality should be. High quality requirements also describe problem paths that may need additional testing.

Even though highly detailed requirements make development easier in future phases, this is not always possible due to time constraints imposed by the client or market conditions. With this in mind, let's look at some secrets to improve your requirements process even under tight deadlines.

Secret #1: Include Use Cases

Use cases look at the requirements from the standpoint of an end user working with the program and how the program responds to the user's inputs. At its simplest level, a use case can be thought of as a play where the end user is one actor and the program is another actor. These two actors then have dialogs which explain the interactions between the actors. More complicated scenarios can have additional actors including other programs, other types of users, and even hardware. Use cases have proven to be very easy to read and understand even for non-technical clients.

Each use case explores what happens when something goes wrong in addition to the "normal" interactions. The exploration of these failure conditions is very important because these cases are the most difficult to code and can cause the most amount of testing. Traditional requirements often ignore these cases. It can be helpful to have developers and testers both think of additional possible failures in a use case so they can be fully documented in the requirements.

Use cases do not provide a complete picture of the system though. A technical specification should also be included in the requirements to detail formulas and routines that take place behind the scenes.

Secret #2: Prototype Screens with a Design Tool

A user of the program only interacts with a program through the user interface so it makes sense to spend a significant amount of time during requirements to ensure that the user interface makes sense, that all functionality is included, and that the most commonly used functionality is easily accessible. The easiest way of doing this is using a screen prototype. There are a variety of methods of making screen prototypes which range from simply drawing the interface with a pen and paper to building "working" prototypes in a higher level language like Visual Basic which allows rapid screen design. However, each of these extremes has serious drawbacks. A pen and paper prototype does not allow users to interact with the prototype and it is more difficult to change. A "working" prototype done in a programming language like Visual Basic can lead the client to believe that the program is nearly complete and that development should not take very long or it can lead the client to believe that changes to the prototype will be costly making them reluctant to make necessary suggestions to improve the program.

Between these two extremes lies screen design applications which allow you to draw the screens and model interactions between screens. High quality prototyping tools allow you to enter sample data and allow users to move between screens by pressing buttons so they can easily understand the interface and its functionality. Most prototyping tools produce the final output in an HTML format so they can be easily shared even if a client is not in the same office where requirements are being developed.

When looking for a prototyping tool, make sure to select a tool which is easy enough to use that you can easily prototype screens while your customer is in the room. This will allow you to brainstorm and make changes to the screens without delays. A prototyping tool should already have common controls already defined to maintain design standards and improve the appearance of your screens. Being able to enter sample data in each screen can allow the customer to pinpoint areas that may be incorrect.

Secret #3: Work Directly with End Users

When designing a new application or making revisions to an existing application, there is no substitute for the direct experience that end users have. An end user can give immediate feedback on your design to point out awkward or incorrect functionality. They also help to ensure that all controls are logically placed for the most efficient use of the system.

Using an interactive prototyping tool allows you to walk a user through the interface or even allow them to work directly with the prototype so they can quickly suggest improvements. As use cases are being developed, it is a good idea to walk users through the use case to ensure that the use case is well thought out and that all functionality is captured both in the use case and the prototype.

Secret #4: Do Iterative Requirements Development

When you create requirements, it is important to develop the requirements in multiple stages. For example, you may want to do a general layout of the program and create higher level use cases in the first session to get a feel for the overall requirements. In the next session(s), you can focus on each key feature to ensure that the normal paths are all defined in the use cases and further refine the prototypes. In the next session(s), you can attempt to define all of the error conditions which can occur and update the prototypes as necessary. The final sessions should review all work previously done to ensure that all requirements are clear and complete. At each stage, you should not be afraid to revise work done in a previous step because getting the requirements correct will ultimately save time in the more costly development and testing stages.

Secret #5: Place Requirements Documents under Change Control

With all of the time spent on generating clear requirements, it is very important to make sure that all of the requirements documents are included in your change control system. This includes use cases, screen prototypes, technical specifications, and any other documents used to define the requirements.

Conclusion In this article, we have explored various secrets to make your requirements process successful and ensure that your clients are satisfied with the resulting program even under tight deadlines. At the start of your next project, make sure you have the proper tools in place for a successful requirements iterations including a prototyping program, a tool to write use cases, and a version control program. These tools do not have to be expensive, and they will help to get your requirements right and schedule under control.