Pages

Monday, July 11, 2011

Installing Active Directory Tools Under Windows Vista (SP2)

This blog post is a step-by-step guide to installing the Active Directory Tools (i.e. Active Directory Users and Computers) on a Windows Vista machine. It has been tested on Windows Vista Enterprise (32-bit, Service Pack 2) but will probably work with all non-home versions.

First of all you need to download the software from Microsoft. If you type "windows vista remote server administration tools" into Google one of the results it returns will be titled "Microsoft Remote Server Administration Tools for Windows Vista", click on this link. Alternatively a direct link is available here;


You will need to have validated your version of window in order to download/ install it.

NOTE: If you are running the 64-bit version of Windows Vista then this is not the right link for you. You can either go to the directly link;


Or type "Microsoft Remote Server Administration Tools for Windows Vista for x64-based Systems" into Google for the correct link.

If you're unsure of which version you're running then go to the start button, right-click "Computer" and then select "Properties". You'll see something like this;
 
Look at the "System type:" value and you'll see what version of Windows you're running.

Once you've got the file install it (it's a standard KB update file, you will need Administrator rights on the machine you are using).
 
After it's been successfully installed go to the Start Menu > Control Panel and select "Programs and Features", then select the "Turn Windowsfeatures on and off" under Tasks on the left;

The "Windows Features" dialog box will be displayed, scroll down to "Role Administration Tools" (under "Remote Server Administration Tools") and select the the following items;

Click "OK" to make the changes.
 
In order to make finding these under the Start Menu a little easier right-click the Start Button and select "Properties";

Select "Customize ..." and then scroll down the list until you see "System administrative tools" and choose where you want the tools to display;

Under the Start Menu you will now see an "Administrative Tools" option, under this you'll see the new AD Tools you've just installed.
 
NOTE: Sometimes a reboot is required to pick up these changes!

Thursday, July 7, 2011

SSRS: Working With Oracle Database Parameters In Report Builder 3

This Knol gives a simple example which shows some of the tricks/ ways of working you might like to use then writing SSRS reports against a back-end Oracle system.


The first thing to do is to open Report Builder, create a new dataset, connect to any Oracle database (the SQL we'll be using will run against any system), and then paste in the SQL;

SELECT
  TRUNC(SYSDATE) as TODAYS_DATE,
  :Where_Test as TEST_PARAMETER
FROM DUAL
WHERE 'TEST' = :Where_Test

As you can see this is pretty simple; it is just returning today's date and the parameter that's being used but only if the user passes in 'TEST'.

Give this a run (pass in TEST) and you'll see something like;

Now if you change the parameter you're passing in to 1234 and re-run;

The error is the standard "ORA-01722: invalid number" error and is due to Oracle trying to convert 'TEST' (in the SQL) to a number which of course fails.

You might assume that setting your "Data Type" to Text for the parameter would work;

You'd be wrong. It makes absolutely no difference.

The only way to resolve this problem is to update the original SQL to;

SELECT
  TRUNC(SYSDATE) as TODAYS_DATE,
  :Where_Test as TEST_PARAMETER
FROM DUAL
WHERE 'TEST' = TO_CHAR(:Where_Test)

By adding the TO_CHAR you are converting whatever value is passed into automatically to a character. Running this SQL (with 1234 as the parameter) will give you;

There is no error (there is no result because '1234' is not 'TEST').

You get exactly the same problems with dates.

Monday, July 4, 2011

Noetix: Adding a new Z$ Column Reference


Sometimes you need to add an additional Z$ column to link between two view. This Google Knol tells you what you need to know to make a simple customisation.

NOTE: It's worth pointing out that there are a narrow range of customisations supported by Noetix and this isn't one of them. If you have purchased NCM (Noetix Customisation Maintenance) then it's likely that you can get them to support this enhancement but it's at the discretion of whoever handles your NCM files.


We will be making this change to the template for a view - what this means is if multiple views are generated from the template all will contain the additional column. This is by far the simplest way to add a new column (we shy away from customising individual views).

For the purposes of this example I'll be adding in a link between the PO_Receipts and the PO_PO_Distributions templates, I'm working against Oracle e-Business Suite version 12.1.3 and as things stand at the moment (Noetix views 6.0.1) there is no existing link.

Looking at the SQL of the built view I can see that the table alias POD maps to PO.PO_DISTRIBUTIONS_ALL which is the oracle base table that I want to publish the ROWID from in order to link to PO_PO_Distributions (if you open the target view, from the PO_PO_Distributions template, you can see the existing Z$ column Z$NPLPO_PO_Distributions is based on the PDSTR alias which in turn maps to PO.PO_DISTRIBUTIONS_ALL which is correct).

If you look into look into the N_VIEW_TABLE_TEMPLATES table (which is a Noetix object) you can see that the active query position at R12 for the view PO_Receipts is 2. This can be tricky to spot but you were provided with a script called get_data_tmpl.sql during the Noetix training which provides the answer.

Finally the SQL;

UPDATE N_VIEW_TABLE_TEMPLATES
SET
  BASE_TABLE_FLAG = 'Y',
  GEN_SEARCH_BY_COL_FLAG = 'Y',
  KEY_VIEW_LABEL = 'PO_PO_Distributions' -- the target template
WHERE 1=1
AND VIEW_LABEL = 'PO_Receipts' -- template name
AND QUERY_POSITION = 2 -- From get_data_tmpl.sql
AND TABLE_ALIAS = 'POD' -- table alias of PO.PO_DISTRIBUTIONS_ALL from PO_Receipts
;

You'll need to save this in a script can call it from wnoetxu2.sql in the normal way.

C# Programming Test #1


Interview test
Ever needed a simple test to get that interviewee talking? The point of this Knol is to provide you with a small code sample to discuss with an applicant.

Given the size of the world and the number of companies in it it's pretty unlikely that either a) whoever you give this test to (as a company) will have read this, or b) if you memorise this (as an interviewee) that this will be the test the company uses.

It's just a bit of fun that comes after I realised that I'd written some technically correct but logically incorrect code. Hope it will be useful to someone someday!

Here is the code snippet;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace SimpleFileRenamer
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] filePaths = Directory.GetFiles(Directory.GetCurrentDirectory());
      if (filePaths.Count() > 0)
      {
        StreamReader file = null;
        string line;
        try
        {
          file = new StreamReader(Directory.GetCurrentDirectory() + @"\Settings.txt");
          while ((line = file.ReadLine()) != null)
            foreach (string OldName in filePaths)
            {
              string[] sRename = line.Split('|');
              string NewName = Path.GetFileName(OldName).Replace(sRename[0], sRename[1]);
              if (Path.GetFileName(OldName) != NewName)
                Directory.Move(OldName, 
                  Path.GetDirectoryName(OldName) + @"\" + NewName);
            }
        }
        finally
        {
          if (file != null)
            file.Close();
        }
      }
    }
  }
}


The first thing to say is that this code compiles and runs. This test isn't about asking people how much they know of the C# syntax and how easily they could write applications using Notepad to compile later. If you like people like that then you're probably after a much longer series of tests!

Question One: What does it do?

A fairly good answer would be: Renaming files based on a series of rules read in from a file.

That's an excellent high-level description that you could give to anyone who would instantly know what was going on. Of course Software Engineers tend to answer in a more complicated way so you can expect some mention of "in the same directory", "using old/new values in the file separate by | (pipe)", "renaming only files where the rules in the settings file require it", etc.

As a quick example of how it works if our Settings.txt file contained two rows:
Old|
_|

And you had the files; Execution_Test.txt and OldData.txt in your directory then after running the application these would be changed to ExecutionText.txt and Data.txt.

Simple eh?

Now here are a (non-exhaustive) list of things that could be raised during a discussion;

  • Lack of comments. Always a good one for the interviewee to raise!
  • There is no error-checking so errors drop right out with the ugly "... has stopped working" windows error message. This can happen in multiple places; Reading from Settings.txt (does it even exist for a start!), renaming a locked file, invalid text in Settings.txt, etc.
  • Variable naming. Very inconsistent; file, NewName, sRename, etc.
  • BUG: The application will try and rename itself and the settings.txt file - ideally both of these should be ignored.
  • BUG: If you have two entries in Settings.txt (say Old|New, and Yes|No) then if you have a file which combines the two entries (OldYes.txt, NewYes.txt, etc) then the application will crash as when it tries to do the second rename the file will no longer exists - the application should read settings and loop files rather than reading files and looping settings.
  • BUG (Obscure): If you are simply changing case (Old > old) then Directory. Move will raise an error, you need to use a temporary file in this special case.

I'm sure there are more (I should really have written these down as I thought of them rather than trying to remember a few days later), let me know all the ones I've missed by commenting below.

Friday, June 17, 2011

Problems Installing SharePoint 2010 on Windows 2008R2 Server (Configuration Failed- error)


This Knol is a bit of a departure for me in that I'm not suggesting a solution to a particular problem more I'm just sharing with the world my total exasperation when trying to get SharePoint 2010 setup and running on an internal test server (so I can test SQL Server Reporting Services Integrated Mode - I'm not even trying to test SharePoint!).

This Knol runs through the process of installing SharePoint 2010 until a "Configuration failed" error occurs in effect ending the process.

I find it staggering that this hasn't been properly tested by Microsoft prior to release of SharePoint 2010 - if I was trying to install software from a different manufacturer I'd expect these kind of problems but performing a practically automated installed by the people who wrote both peices of software and it not working is not really acceptable.

Hopefully someone at Microsoft will read this and duplicate the problem on their servers and provide a solution. Hopefully.


Build and configure your Windows 2008R2 server, to exactly duplicate the error message (and process below) after you've booted into Windows add the feature ".NET Framework 3.5.1" as well as the prerequisite Features and Services (IIS) that it requires.

Once you've done that you're ready to go through the process below.

Run the SharePoint 2010 Installer (as provided on the DVD):


Click on "Install software prerequisites" under the "Install" section:


Click "Next", accept the licensing agreement (after reading it of course!), then click "Next" to begin the installation:


This will take about 10 minutes, probably for the first time on an installation dialog (that I’ve noticed) you actually get the time the process started as well as how long it’s been running for. Something I think we should encourage!

Actually it doesn’t – it lets you know when the current step started and how long that’s been running for. Much less useful. Ah well, we’re getting there I suppose!

Once the installation has completed you’ll see the dialog:


Click on "Finish" to restart your system.

Once your system comes back up re-run the SharePoint 2010 installer and this time select "Install SharePoint Server". After a few seconds you'll be prompted to enter your Product Key, type that in, wait a few seconds for it to be validated, then click "Continue", accept the licensing agreement, and then click "Continue":


Select "Standalone" as we're building a single box instance (rather than adding a new component(s) to an existing farm):


The installation process will now continue, once it has completed it will display the following dialog:


Clicking on "Close" will trigger the SharePoint Products Configuration Wizard to start up:


Click "Next" and a dialog will appear:


This dialog is simply warning you that if you're on a production server that users are actually using then they can expect the service to be unavailable (potentially) depeding on what you select in this wizard. We're on a new server and so don't really care. Click "Yes" to continue:


The configuration will now take place and then the following dialog is displayed:


Nice.

For the sake of completeness here is the text of that error message:

"Configuration Failed


One of more configuration settings failed. Completed configuration settings will not be rolled back. Resolve the problem and run this configuration wizard again. The following contains detailed information about the failure:


Failed to create the configuration database.


An exception of type System.Security.Cryptography.CryptographicException was thrown. Additional exception information: The data is invalid.


To diagnose the problem, review the application event log and the configuration log file location at:





Click Finish to close this wizard."

Why installing the latest version of SharePoint on the latest version of Windows Server doesn't work out of the box is beyond me.

Friday, June 3, 2011

SSRS: Accessing Report Builder 3

This blog post covers accessing and installing the "Report Builder" tool that comes with Microsoft SQL Server Reporting Services (SSRS) 2008R2.


All access to Report Builder is obtained via Internet Explorer. In order to get access to the system you will require specific permission – without it the instructions below will not work (the “Report Builder” button will not be visible).

To start Open “Internet Explorer” and go to the following URL:

https:///Reports/

Where is the name of the SQL Server on which Reporting Services has been installed.

After a few seconds pause Internet Explorer will display something similar to:


The available options on your screen will depend on the permissions the administrator of the system has defined for you.

This is the "main" page for SQL Server Reporting Services. This version is slightly updated for the latest 2008R2 version of SQL Server.

Looking at the "buttons" on the menu bar click on the one labelled "Report Builder":


This will bring up a dialog:


If this is the first time you've clicked "Report Builder" then the software will download and install on your machine. The installed software is user-specific so no-one else using your computer will have access to it and it does not require elevated permissions to install (i.e. it will not trigger UAC on Vista or Windows 7).

It's about 70MB so the download could take a few minutes. Once it's completed you will see a splash screen as Report Builder starts up:


This splash screen is displayed while the application starts, as soon as the application is setup you will see a selection screen:


Select the type of report you want to proceed (i.e. Table or Matrix Wizard).

SSRS: Adding Parameters in Query Designer (When Using a DataModel as a Data Source)

This blog post gives an example of how to add a parameter to a report using Microsoft SQL Server 2008R2 and the Report Builder 3 tool.


After running Report Builder and opening your report you will see something like this;


Expand the "Datasets" node in the treeview on the left;


If you right-click the active Dataset (DataSet1 - highlighted above) and then select "Dataset Properties";


This screen is showing you a lot of technical details about the Query you have put together. Click "Query Designer ..." to get to something more meaningful. To use the "Dataset Properties" screen you will need  training.

The "Query Designer" screen appears and, if you used the wizard to generate your reports,  you'll remember it from them:


Click on the "Filter" icon in the bar at the top. This will display the "Filter Data" screen:


Scroll down the Field list (bottom left) until you find the field you're interested in adding as a parameter. For the sake of this example I'm going to add the "INVOICE DATE" field. When you find the field you're after you can either double-click it or drag/drop it into the "xxxx INVOICESs with:" area):


If you hover over the "equals" (next to INVOICE DATE) it will turn into a click-able link. Click it:


Select "On or After" in the list and then hover over the "INVOICE DATE" (which will also turn into a click-able link) and right-click it:


Select "Prompt" (this means the user will get a prompt).

Click "OK" to save the changes and close the dialog.

We are now back to the "Query Designer" main page and it looks like nothing has changed. Click "Run" button:


A dialog will now appear asking for a value for the "INVOICE DATE" parameter.


Click "OK" and the report will run and give you values for the specified date.

Click "OK" to save the changes to the Query and then click "OK" to save changes to the Dataset and return to the main editor.

Click "Run" at the top left:


This will switch to the report run viewer and, as there is a report, will prompt you at the top of the screen for a value:


Enter "20-APR-2010" and either hit return or click "View Report". The report will now run with the specified parameter.