Friday, July 29, 2011

Low-budget warm-up for Web application or how to automate ping a Website

In different IT scenarios there’s a need to access a Website just to check if it is available or even to ignite it’s start.

There are some automation tools for this purpose: I’ve seen even a download from Microsoft Website for warm-up of Microsoft CRM Websites – but do not recall where.

The quick and cheap alternative is to use PowerShell script for this purpose and bind it to a scheduled task.

This is the script – quite self-explanatory

    #check and create an eventlog source to report results of website probing
$eventLogSource =
"ProbeWeb";
if (![system.diagnostics.eventlog]::SourceExists($eventLogSource))
{
new-eventlog -logname Application -source $eventLogSource
}
#create webclient
$webClient = new-object System.Net.WebClient
$output = "";
$webSite = “http://winmike.blogspot.com”;
$startTime = get-date
#probe thewebsite
$output = $webClient.DownloadString($webSite)
$endTime = get-date
#test website response for desired character sequence
if ($output -like "*Mike*")
{
$message = $webSite + " succeeded " + $startTime.DateTime + " " + ($endTime -$startTime).TotalSeconds +
" seconds"
}
else
{
$message = $webSite + " failed " + $startTime.DateTime + " " + ($endTime - $startTime).TotalSeconds +
" seconds"
}
#record the results
write-eventlog -logname Application -source $eventLogSource -eventID 42
-message $message
Save this script in a file on the disk (for exampe, in c:\scripts\probeweb.ps1).
Start the script from powershell
x10sctmp0
and you will see the output in the eventlog - smth like that:
x10sctmp
Well, now bind it to a scheduled task. Open the Task Scheduler Library (via computer management) and select “Create Basic Task…”:
x10sctmp1
Enter task name and description, then select time period to repeat the task:
x10sctmp2 x10sctmp3
Select “start a program! as a task action:
x10sctmp4
Enter program name as follows
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
(check the %SystemRoot% – your drive letter and path may vary)
and
c:\scripts\probewe.ps1
as argument (or alternate path to your script):
x10sctmp5
Review summary of the task:
x10sctmp6
…and confirm the task. You will see the task in the list of your task library:
x10sctmp7
Open the task properties and assure “Run whether user is logged on or not” is selected and the correct user account is used as execution context.
x10sctmp9
Confirm the password if requested.
Run newly created task to make sure it works:
x10sctmp10
Analyze the results
x10sctmp11
…and enjoy!

Monday, July 11, 2011

CD/DVD/Data Recovery source (hints and utilities)

Neither an advertisement, nor announcement. No my personal warranty. Only recommendation.

I was looking for help to rescue some data on my older CDs and HDDs. Found here: RLAB.

x10sctmp

You’ll find there many useful data recovery utilities – and numerous freeware among them.

Used with success:

R.Viewer – creates list of the disk files in different formats. This utility is very useful to get a snapshot of the file list on your drive: for example, to compare it with an earlier backup set or for other purposes. Supports CSV, HTML, XML formats – the result can be used in Microsoft Excel for filtering,sorting and further processing.

CHKParser32 – supports recovery of the damaged data, found after running chkdsk utility. Check Disk (chkdsk) utility collects “orphaned” or other way damaged files in .chk files. CHKParser32 helps to join them into meaningful data files (pictures, texts etc.).

Saturday, June 25, 2011

How to: perform page break by printing ASP.NET Web forms

Once we created an ASP.NET Web Application having web forms the next request was to organize carbon copy of these forms: do print them and support page breaks.

The solution is:

  • declare dedicated div style class for separate print pages
  • add page-break-after: always; property to this class
  • enclose the print pages in separate div elements and set their style to the class declared above

Example:

the ASP.net Form:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="WebForm.aspx.cs"Inherits="WebForm"%>
<!DOCTYPEhtml PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
htmlxmlns
="http://www.w3.org/1999/xhtml">
<
headrunat
="server">
    <
styletype="text/css"media
="screen">
      
.formLabel
      
{
            min-width: 100px;
            color: Blue;
        }
       
.formTextBox
      
{
            width: 200px;
        }
    </style
>
    <
styletype="text/css"media
="print">
      
.formLabel
      
{
            min-width: 100px;
            color: Black;
        }
       
.formPage
      
{
            page-break-after: always;
        }
       
.formTextBox
      
{
            width: 200px;
        }
    </style
>
    <
title>Department Form</title
>
</
head
>
<
body
>
    <
formid="form1"runat
="server">
    <
div
>
        <
divclass
="formPage">
            <
asp:LabelID="LabelName"runat="server"Text="Name:"CssClass="formLabel"Width="100px"></asp:Label
>
            <
asp:TextBox ID="TextBoxName"runat="server"CssClass="formTextBox"></asp:TextBox
>
            <
br
/>
            <
asp:LabelID="LabelPhone"runat="server"Text="Phone:"CssClass="formLabel"Width="100px"></asp:Label
>
            <
asp:TextBox ID="TextBoxPhone"runat="server"CssClass="formTextBox"></asp:TextBox
>
            <
br
/>
        </
div
>
        <
divclass
="formPage">
            <
asp:LabelID="LabelAddress"runat="server"Text="Address:"CssClass
="formLabel"
              
Width="100px"></asp:Label
>
            <
asp:TextBox ID="TextBoxAddress"runat="server"CssClass="formTextBox"></asp:TextBox
>
            <
br
/>
            <
asp:LabelID="LabelRegPlate"runat="server"Text="Reg. Plate:"CssClass
="formLabel"
              
Width="100px"></asp:Label
>
            <
asp:TextBox ID="TextBoxRegPlate"runat="server"CssClass="formTextBox"></asp:TextBox
>
            <
br
/>
        </
div
>
    </
div
>
    </
form
>
</
body
>
</
html
>

The form in browser:
image

The form in print view:

imageimage

Enjoy!

Wednesday, June 22, 2011

Troubleshooting Firefox 5 and delicious bookmarks

Firefox 5 is here, and the problem described here appears again.

Use the same “cure”: change “4.*” to “5.*” and enjoy!

Wednesday, June 15, 2011

TFS 2008 Problem: Unable to connect to the Windows SharePoint Services

Assume, you plan to create a new TFS project using TFS 2008. Everything goes well up to the last step - then an error dialog appears saying “Unable to connect to the Windows SharePoint Services at <URI>”:

image

The reason is, the TFS instance cannot create the Sharepoint Portal for the project. More information is to find in the error log file on the TFS server.

Most popular problem are changed connection properties to Sharepoint instance (for example, port number). In this case the log file contains message, that the server rejects the connection on used URI.
(We discounter this error due to uncoordinated change in Sharepoint configuration, where the port number was altered in mistake).

OK, two things to take away.

1. Show the current TFS settings.

Log-in to TFS server, got to the TFS program files folder, the to the “Tools” subfolder – here you find the TfsAdminUtil: administration utility for TFS.

Start it using following command line:

TfsAdminUtil configureconnections

You see all the important current settings for local TFS instance:

image

2. Change required setting

For this task TfsAdminUtil offers set of keys/options:

x10sctmp0

For example, use /SharepointAdminUri: to change Sharepoint Administration URI:

TfsAdminUtil configureconnections /SharepointAdminUri:http://myserver:myport/_vti_adm/admin.asmx

Think about full path to the administration service file (.asmx), not just admin site URL!

image

Use TfsAdminUtil to view changed settings as shown above, restart TFS server and enjoy!

Tuesday, May 31, 2011

Online virus check: http://www.virustotal.com

Online tool to check any file or web site for viruses and malware:

http://www.virustotal.com

x10sctmp

Enjoy!

Friday, May 20, 2011

How Internet Explorer versions handle bad-formed XML files

Following the change from Beta to RTM Version of IE 9 in display of XML files feature we continue to work with IE using it to display XML files in certain situations.
Well, after the IE9 RC version turned back to “traditional” XML data display format, the problem seems to be solved.
But there’s a significant change in this functionality of Internet Explorer 9 and Internet Explorer CTP 10 in XML data display policy: this time it is about the bad-formed XML files.
Assume a well-formed XML file:
<root>
<element name="3" />
sample text
<element name="1" />
<element name="2" />
</root>
 
This file is displayed properly in IE8:
 
x10sctmp2
in IE9:
 
x10sctmp0
 
and in IE10:
x10sctmp1
 
Then we try following bad-formed XML data:
<root>
sample text
<element name="1" />
<element name="2" >
<element name="3" />
</root>

(the element [element name=”2”] has no closing tag)

This file is displayed in IE8 as expected:

x10sctmp3

The IE9 displays the same data as follows:

x10sctmp4

Neither the error notification nor any explanation are presented to the user. Via the option “View Source” you can see the source XML data, but again – no error information exists:

x10sctmp5

The same for HTML view in Developer Tools Window (activated by F12):

x10sctmp6

And only Console view:

x10sctmp7

and Script view provide us with error information:

x10sctmp8

Same behavior shows also the IE10 CTP:

x10sctmp9 x10sctmp10

Using “Force IE7” … “Force IE9” mode doesn’t affect this behavior.

The FireFox 4 displays the same well-formed XML:
x10sctmp11

and bad-formed as expected from previous FF versions:
x10sctmp12

This difference in handling of bad-formed XML data may be essential for a custom application using web browser to display XML data. Just keep it in mind…

Wednesday, May 18, 2011

Microsoft Office 2010 Service Pack 1 is here

As announced on the TechEd 2011, “Service Pack 1 [for Microsoft Office 2011 – mb]is on track for release at the end of June.”.

The most important highlights:

  • Outlook fixes an issue where “Snooze Time” would not reset between appointments.
  • The default behavior for PowerPoint "Use Presenter View" option changed to display the slide show on the secondary monitor.
  • Integrated community content in the Access Application Part Gallery.
  • Better alignment between Project Server and SharePoint Server browser support.
  • Improved backup / restore functionality for SharePoint Server
  • The Word Web Application extends printing support to “Edit Mode.”
  • Project Professional now synchronizes scheduled tasks with SharePoint task lists.
  • Internet Explorer 9 “Native” support for Office Web Applications and SharePoint
  • Office Web Applications Support for Chrome
  • Inserting Charts into Excel Workbooks using Excel Web Application
  • Support for searching PPSX files in Search Server
  • Visio Fixes scaling issues and arrowhead rendering errors with SVG export
  • Proofing Tools improve spelling suggestions in Canadian English, French, Swedish and European Portuguese.
  • Outlook Web Application Attachment Preview (with Exchange Online only)
  • Office client suites using “Add Remove Programs” Control Panel

Lucky me, starting from now I can display the PP presentation on the secondary monitor (usually projector), having my primary display on the notebook running web browser and mail client without risk to expose sensible data to the students.

I was really waiting for this feature…

Monday, May 16, 2011

Federal Communications Commission’s Website unavailable

Days after announcing PLAN (Personal Localized Alerting Network) stays the Federal Communications Commission’s Website unavailable – occasion?

x10sctmp

Friday, April 15, 2011

Internet Explorer 10 Preview: download the testdrive

IE10 is available for download: http://ie.microsoft.com/testdrive/

Here is it:
image

Lot of Demos, Developer Information etc. User Guide is here: http://ie.microsoft.com/testdrive/Info/UserGuide/

Developer Tools are already included and can be launched as usual: F12. As expected, browser compatibility mode 10 has been added:

image

Useful: main menu –> Report Issue –> Run IE Diagnostics. Displays a lot of info about current system and provides 2 protocol options - network and process activity:

image

The results are written in a cab file.

“Microsoft continues HTML5 commitment and leadership with the first platform preview of Internet Explorer 10.” (from here)

IE10 expected to be delivered also for tablets, in perspective probably also for Windows Phone devices.

While there is no support for Windows Vista and older, this preview version does install and run side-by-side with IE9 on the Win7 with all most recent updates and fixes – at least on my machine. The public updates are expected to be available every 12 weeks.

Download and enjoy the exploring of IE10!

Friday, April 08, 2011

Troubleshooting Firefox 4 and delicious bookmarks

If you used delicious bookmarks with FF 3.x and recently updated FF to the version 4.0, you’ll be negatively surprised, the delicious toolbar is not displayed anymore: the delicious bookmarks add-on isn’t yet officially compatible to FF 4.0.

The found solution (here in german: http://wordpress.kendaric.net/2011/03/17/delicious-plugin-im-firefox-4-nutzen/) described the steps to solve the problem:

  1. Start FF and navigate to “about:support
  2. Click “Open containing folder”
    image
  3. Navigate in the newly opened explorer window to subfolder “extensions\{2fa4ed95-0317-4c6a-a74c-5f3e3912c1f9}”:
    image
  4. Open install.rdf and find the line with “em:maxVersion”
    image
  5. Change the value to “4.0”
    image
  6. Save the file and restart FF.
  7. Enjoy!Smile

Wednesday, April 06, 2011

Display last “build completed” time in Visual Studio 2008/2010

The build process in VS08/10 doesn’t display by default the timestamp of the “build completed”:

image

We use following post-build event setting:

[your code if necessary]
echo build completed
time /t


image


This generates a timestamp in output window displaying the time when the build was completed:


image


So you can see if you are dealing with most recent build.


Enjoy!

Friday, March 25, 2011

Microsoft SharePoint Foundation 2010 prerequisites

Before you start to install Microsoft SharePoint Foundation 2010, ensure you installed all the prerequisites. You can check them directly from the setup package.

Otherwise download them from Microsoft download center or other web resources - like this one:

http://forum.it-share.ro/Forum/Sharepoint%202010%20Prerequisite%20Download/Forms/AllItems.aspx?View={F50B49F5-3617-43BB-9FB4-3C4F51B805C7}

Here is as for today only the reporting services add-in missing – you will find it here:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b3bebf9d-d86d-48cd-94e2-0639a846be80

Enjoy!

Thursday, March 03, 2011

ASP.NET & AJAX: “Object required” Script error while using ModalPopupExtender

Loading an ASP.NET Webpage containing ModalPopupExtender you may encounter following error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Timestamp: Thu, 3 Mar 2011 07:21:58 UTC


Message: Object required
Line: 106
Char: 13
Code: 0
URI:
http://localhost:49461/ScriptResource.axd?d=dVTmaeP-mJEQBF1x5WPACI57lI3BdxWWqqcjOSvk5IFYlzy3XmoJ3-mETMUX_E93dUXCirqabEt7Y5F8nk9OJF0v1sSq6MFJL4n1ystjZ74KXzsw7JAw7fRseSEZ165rrnTm4dOfgdUE7UZpQUpfBqdlctB5nzYxeqQR46Jg_TR_hyK50&t=ffffffffa4fab0f1

image

Start debugger, and you will learn more:

image

this._popupElement = $get(this._PopupControlID);
if (this._DropShadow) {
this._foregroundElement = document.createElement('div');
this._foregroundElement.id = this.get_id() + '_foregroundElement';
this._popupElement.parentNode.appendChild(this._foregroundElement);
this._foregroundElement.appendChild(this._popupElement);
}
else {
this._foregroundElement = this._popupElement;
}


The cause of this error is most likely the Panel used as TargetControl for ModulPopupExtender. Check if this Panel not set accidentally to



Visible="false"


In this case ASP.NET doesn’t render this panel at all, and the _PopupControlID property of the popup extender on the client side points to non existent object.


Check the Visible attribute of the popup panel, reset it to visible and enjoy!

Wednesday, March 02, 2011

Internet Explorer reports error: “The specified module could not be found”

Browsing (your customized?) ASP.NET application with IE7/8/9 you may encounter following error:

clip_image001

The error message says: “The specified module could not be found”. Most frequently you will encounter this error while displaying the pages containing Accordion AJAX control.

Surprisingly, other browsers like Firefox or Chrome do not cause this error and still display the Web application pages and all the controls correctly.

There are numerous methods to debug this error, we selected the local instance of Visual Studio:

clip_image001[4]

The error occurs exactly in getOpacity() function of a local JScript:

clip_image001[6]

getElementOpacity : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var hasOpacity = false;var opacity;if (element.filters) {
var filters = element.filters;if (filters.length !== 0) {
var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];if (alphaFilter) {
opacity = alphaFilter.opacity / 100.0;hasOpacity = true;}
}
}

Quick watch on the filters says exactly the error we saw above:

clip_image001[8]

The Interface IHTMLFilterCollection is implemented in oleaut32.dll:

clip_image002

clip_image002[4]

clip_image002[6]

clip_image002[8]

There’s a Microsoft KB article describing a similar problem: http://support.microsoft.com/kb/281679/de.

According this article just try to re-register the oleat32.dll and actxprxy.dll:

clip_image002[10]

clip_image001[10]

clip_image001[12]

On some computers it helped.

On others we were obliged to re-run dxdiag: to detect any DirectX errors on the workstations. Some of them were cured just after installing of most recent DirectX graphics drivers

The rest of boxes displayed the same error: “DCIMAN32.DLL is missing”.

This is a symptom, some of latest software updates or new installations corrupted the system and removed the DCIMAN32.DLL from the %SYSTEM% folder. Short description was presented here: http://answers.microsoft.com/en-us/windows/forum/windows_7-system/dciman32dll/b38a81fa-89f2-4550-8749-89e91a6f0a40

But one more tasks of this library is to provide Internet Explorer with additional graphics related functions, that rely on the interfaces of this library and underlying modules. Fortunately, other browsers do not rely on this operating system dependent functionalities, so they can display the pages correctly.

What we’ve done was the fresh copy of DCIMAN32.DLL form an healthy reference system directly into %SYSTEM% folder of the victim machine – you do not event need to register this library with regsvr32 or reboot the computer.

It just worked after this – try to follow the steps and enjoy!