Friday, July 2, 2010

Notepad++ to recognize custom file extensions

As many others, I am using Notepad++ as an editor to modify many XML files, which may have different extensions than XML. Such files may be configuration files for ASP.NET or MSBuild files. By default, when I opened them in Notepad++, I saw no syntax highlighting, everything was just black and white. In order to turn the highlighting on, I needed to explicitly select XML as a language each time when I opened such files.

However, using the following link, I just set extensions to what I needed.

http://www.mattblodgett.com/2007/11/notepad-tip-syntax-highlighting-for.html

So I have those files immediately recognize as XMLs when I open them

Thursday, April 22, 2010

SharePoint Server 2010 goes RTM

SharePoint Server 2010 RTM is available for MSDN subscribers at
MSDN subscription download area

Available to Levels: VS Pro with MSDN Premium (Empower); Developer AA; VS Premium with MSDN (MPN); VS Pro with MSDN Premium (MPN); MSDN Universal (VL); BizSpark Admin; BizSpark; VS Ultimate with MSDN (VL); VS Premium with MSDN (VL); VS Premium with MSDN (Retail); VS Ultimate with MSDN (Retail);

A Russian version of SharePoint Server 2010 is available at TechNet

Available to Levels: TechNet Plus SA Media; TechNet Plus (Retail); TechNet Direct (Retail); TechNet Plus (VL); TechNet Plus Direct (VL); TechNet Cert Partner; TechNet Gold Cert Partner; TechNet Plus Consumer Service Professional Pilot; TechNet Standard (VL); TechNet Standard (Retail);

Friday, April 16, 2010

Generate New GUID by PowerShell

It's simple and easy to get GUID using PowerShell.
Just type the following line in PowerShell command prompt:
[System.Guid]::NewGuid().toString()
If you need GUID wrapped in curly braces modify the script line to:
"{"+[System.Guid]::NewGuid().toString()+"}"

For me the typical action after getting a GUID is to copy it to the clipboard so the following snippet is my favorite.
$guid="{"+[System.Guid]::NewGuid().toString()+"}"
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$dataObject = New-Object windows.forms.dataobject
$dataObject.SetData([Windows.Forms.DataFormats]::UnicodeText, $true, $guid)
[Windows.Forms.Clipboard]::SetDataObject($dataObject, $true)
write-host The following GUID has been copied to the clipboard: $guid
So once you run the last script you have a new GUID in the clipboard. As for me - that what I call convenient

Friday, April 9, 2010

Hello PowerShell!!

As soon as new Microsoft Products are delivered with PowerShell SnapIns it makes more sense to put a toe into programming it. I have Windows Server 2008 R2 as a main platform for development. On Windows Server 2008 R2 Windows PowerShell ISE isn't running by default. To turn it on, a corresponding feature, called Windows PowerShell ISE should be added in Roles and Features. To do this:
1) Open Windows Start menu.
2) Right click on Computer
3) Select Features
4) Add "Windows Powershell Integrated Script Environment" feature

When ISE is added you could just open Start menu and type "ISE". If you have Windows Vista, Windows 7 or Windows Server 2008 you'll a couple of programs displayed.


Alternatively, you could just select it though Start/Accessories/PowerShell menu

Right click on it and select "Run as an administrator". For some tasks it's not needed, but some just fail without trying to elevate permissions.
When you have ISE opened you'll see a windows separated to 3 areas.

The top part (Script Pane) allows to edit a script and run it at once The middle (Output Pane) shows PowerShell output and the lower one (Command Pane) allows to enter commands interactively, one by one. To make the intro complete we'll run a Hello World like program to be sure that we have really started.
So, copy the following two lines to the Script Pane (top one)

name = Read-Host -Prompt "What is you name?" Write-Host Hello $name! Welcome to PowerShell world
and then press "Run"

you'll see a prompt asking for a name. Enter your name and press ok

Then you'll see that a middle sections contains a prompt welcoming you to the world of PowerShell.

After running a script all variables are stored in the session and you could access them through the immediate window
So if you put
$name
into the Command Pane and press Enter

you'll see what name was entered previously

As any language, PowerShell has much more to learn, but it's a scripting language that worth investing your time if you work on Windows Platform

Wednesday, March 24, 2010

Clear Analysis Services cache

As you probably know, Analysis Services caches results of queries on a cube. Thus, if you're making a new query soon after the previous one, most probably you get the same results even you have new data in the underlying relational database. In most cases, it makes Analysis Services performance better. However, sometimes you need to get up=to-date results from a cube instantly. The simplest way I know is:
Open SQL Server Management studio and connect to an Analysis Services instance.
1) Select a database that contains a cube you want to be updated.
2) Run a new XMLA query query.

3) Insert content below.
<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ClearCache>
<Object>
<<DatabaseID&gtAdventure Works DW 2008R2 SE</DatabaseID>
<CubeID>Adventure Works DW</CubeID>
</Object>
</ClearCache>
</Batch>

4) replace a database ID with database name that you selected

5) copy a cube's ID from the cube's properties and update CubeID parameter.

6) Run a query and ensure that no errors have been returned

The query works for SQL Server 2008 (might be working for other version but I didn't check it yet)

Friday, March 19, 2010

Showing Analysis Services data with SharePoint 2010

My current task now is to make Excel Chart running on SharePoint 2010. That task is relatively simple when you have a standalone VM. However, it turned out that that causes issues when the configuration is distributed and the SharePoint is a part or a domain (which is the common case, actually)
The most complete description on how to make it working is available at
Weblog Ton Stegeman [MVP]

How to rename SQL Server instance

A quick an nice way to restore SQL work after renaming a computer
How to rename SQL Server instance