Learn IT

Free learning anything to everything in Information Technology.

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.

Overview: Test Driven Development

There are many benefits of test driven development including better end product with well defined supporting unit tests and having a programming paradigm that is a bit more flexible in regards to scope changes. Having unit tests available will make our code more maintainable over the long run is invaluable because we can modify our code without fear such as when we are adding/modifying functionality or refactoring. It could even be considered crucial when we have projects where the scope is likely to change throughout the development lifecycle like in the case where the functional specifications are not clearly defined before we begin producing code.

Test driven development can be a huge shift in the development approach for many of us. The test driven approach basically chips away at the solution like a sculptor would at a marble block instead of trying to define and create a monolithic application in one shot.

As a first step, we'll define the interfaces out software will adhere to. The interface should clearly define how our class is to interact with other classes and what information it will expose. This is a crucial step in any software design process because we really have to know where we are going and the interface serves as a map that will help us get there.

After we have an interface, we'll begin with the test-driven development cycle.
  1. Add a test
  2. Run all tests and watch the new one fail (and the rest succeed)
  3. Modify our code to make the test succeed
  4. Run all tests and watch them succeed
  5. Refactor, if necessary
  6. Run tests to ensure everything still works
  7. Repeat

Understanding MOSS 2007

The core target of Microsoft Office SharePoint Server (MOSS 2007) is to aggregate disparate (Different but separate applications) information, events, processes and enterprise services into a unified single view without to open multiple applications and cut and paste information across multiple screens.

In MOSS 2007 these composite applications are based on the concept of a service-oriented architecture (SOA). MOSS 2007 framework helps you develop components as distributed, reusable business services. MOSS 2007 split into small applications in small pieces.
MOSS 2007 is basically superstructure who represents the high-level integration of users, one-stop shop form information, managing interactions between people, and line-of-business (LOB) data within organization and cross enterprises. MOSS 2007 based on SOA framework that is driven by standard XML/ Web services.

It provides a window that connects people, processes, and information to create a unique & rich end user experience. For example, during a natural disaster, it can provide critical information to coordinate a response effort, monitoring traffic patterns, delivering supplies, dispatching resources, and aggregating information to present operational insight. In a manufacturing setting, you might use it to monitor inventory levels and assembly processes up and down a supply chain. It's an excellent aggregation point for all of these types of situations.

MOSS 2007 is point of collaboration & contents sharing. For example, SharePoint Portal includes workspace to help loan officers find, organize, and share information so they can process loans more efficiently. These workspaces used to be very limited in their reach, which resulted in a proliferation of mediums to support discrete processes. A mortgage broker might use a file system to store documents, e-mail to deliver loan applications to customers, a Web site to gather additional customer information, and a spreadsheet to monitor the loan approval process.

MOSS 2007 can unify all these tasks and offer collaboration tools to streamline the loan approval workflow. Loan officers will then have a single place to access and modify documents, check documents in and out of a repository, and work collaboratively to process loans, all without having to use multiple interface mechanisms.

So, MOSS 2007 become more process-centric, they serve as clearinghouses for managing multiple activities in multiple manners.

How To: Generate unique strings and numbers in C#

The System.Guid is used whenever we need to generate a unique key, but it is very long. That's in many cases not an issue, but in a web scenario where it is part of the URL we need to use its string representation which is 36 characters long. It clutters up the URL and is just basically ugly.

It is not possible to shorten it without loosing some of the uniqueness of the GUID, but we can come a long way if we can accept a 16 character string instead.

We can change the standard GUID string representation:

21726045-e8f7-4b09-abd8-4bcc926e9e28

Into a shorter string:

3c4ebc5f5f2c4edc

The following method creates the shorter string and it is actually very unique. An iteration of 10 million didn.t create a duplicate.
It uses the uniqueness of a GUID to create the string.

private string GenerateId()
{
long i = 1;
foreach (byte b in Guid.NewGuid().ToByteArray())
{
i *= ((int)b + 1);
}
return string.Format("{0:x}", i - DateTime.Now.Ticks);
}


If you instead want numbers instead of a string, you can do that to but then you need to go up to 19 characters.

The following method converts a GUID to an Int64.

private long GenerateId()
{
byte[] buffer = Guid.NewGuid().ToByteArray();
return BitConverter.ToInt64(buffer, 0);
}


The standard GUID is still the best way to ensure the uniqueness even though it isn't 100% unique.

The benefits of Office PerformancePoint Server 2007

Office PerformancePoint Server 2007 greatly improves visibility into company performance and the factors that are driving it. Office PerformancePoint Server 2007 also enables employees to monitor and act on performance variances.
Office PerformancePoint Server 2007 offers:
  • Robust monitoring and analytics capabilities. Office PerformancePoint Server 2007 monitoring and analytics capabilities enable business users to see and understand performance issues quickly so they can make better decisions faster—all without the need for technical assistance. The fact that scorecards, dashboards, and analytics are all integrated into the same application makes deployment simple and helps drive alignment and accountability. Office PerformancePoint Server 2007 helps individuals to be more effective and the organization to be more agile.

  • Improved planning, budgeting, and forecasting. Drive strategic objectives and goals into the planning and budgeting process to ensure departmental plans align with corporate strategy. Reduce the time and effort required through centralized control and administration and workflow that manages the creation and submission.

  • Faster financial reporting and consolidation. Consolidate financial data from multiple general ledgers and reporting systems to achieve a single, integrated view of financial information. Robust integration and administration of financial information helps increase information accuracy and reduce the time and effort required for statutory and management reporting.

  • Extends Existing IT Investments. Office PerformancePoint Server 2007 utilizes widely used and supported Microsoft technologies such as Windows Server, SQL Server, and Microsoft Office SharePoint Portal Server. This utilization enables companies to extend their existing investments and IT skill sets in these mission-critical enterprise technologies.

Features: Office PerformancePoint Server 2007

Office PerformancePoint Server 2007 features robust performance management capabilities including:
  • An integrated application for performance management. Office PerformancePoint Server 2007 provides all of the functionality that is needed for performance management in a single, integrated application including scorecards, dashboards, management reporting, analytics, planning, budgeting, forecasting, and consolidation. With Office PerformancePoint Server 2007, users can better understand variances between plan and actual, quickly analyze root-causes, and recast plans when necessary. Customers can enter the performance management process at any point, benefiting from a common data model shared across monitoring, analytical, and planning activities.

  • Business users shape their plans the way they think about their business. Office PerformancePoint Server 2007 provides business users with the ability to define, modify, and maintain their plans easily. The application handles the sophistication of the company business processes (rules, logic, calculations, and workflows) while helping more users contribute to the performance management process.

  • Flexibility to handle complex environments. Office PerformancePoint Server 2007 uses a model-driven approach to make it easier to create corporate models for scorecards, analytics, and plans that can also be used for departmental-level performance management. By providing synchronized models up and down the organization as well as across departments, users can more easily get a consistent view of organizational performance.

  • Reducing complexity for IT and for the business. Office PerformancePoint Server 2007 enables businesses to broadly deliver performance management across the organization by rapidly bringing together the power of Microsoft Office and the performance, scalability, and security of SQL Server. Office PerformancePoint Server 2007 is easy to use and less costly to deploy than traditional solutions. Office PerformancePoint Server 2007 also helps IT better support corporate governance through the ability the audit the performance management process as well as control versions and report on the processes.