fredag 17 juni 2011

Annoyed of all the “J”s that appears in iPhone’s mail client?

Annoyed of all the "J"s that appears in iPhone's mail client? I'm afraid I don't have any tips for you, but at least you can avoid sending them yourselves.

The "J"s show up because Microsoft Outlook, the ubiquitous mail client, auto corrects smileys into symbols from the Wing Ding font set. E.g. :) into J — which is "J" in Wing Ding.

The easiest way to avoid is typing a ctrl-z to undo the auto correction. The long term solution is to go into the auto correction settings and delete this particular rule.

torsdag 9 juni 2011

Problem with Rendering Multi Page SSRS Reports after Upgrade to SSRS 2008 r2

I ran into a strange problem with multi page rendering after a client upgraded the reporting server to 2008 r2.

Background

Basically I'm using the method described here to render the pages of a Reporting Services Report to a bunch of image streams. What happened after the upgrade was that some renderings worked and some didn't. After much gnashing of teeth and hair pulling I realized the difference between those that worked and those that didn't. The ones that didn't work were rendered fresh, with the parameters passed in. Those that did work however had already been executed once and were rerendered with the ExecutionID of the earlier execution passed in.

Workaround

Google was of no use in this case, so I decided to do a work around. It turned out to be quite easy to "prerender" the report using another overloaded version of the Render method, and then use the ExecutionID from that rendering and continue as usual.


if (ExecutionID == null)

{


// Pre rendering

rview.ServerReport.SetParameters(Parameters);


 


string encoding;


string[] streamids;

Microsoft.Reporting.WebForms.Warning[] warnings;


byte[] bytes = rview.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

ExecutionID = rview.ServerReport.GetExecutionId();

}

rview.ServerReport.SetExecutionId(ExecutionID);


 

NameValueCollection urlAccessParameters = new NameValueCollection();

urlAccessParameters.Add("rs:PersistStreams", "True");


 


// Render first page

Stream s = null;

s = rview.ServerReport.Render(format, deviceInfo, urlAccessParameters, out mimeType, out extension);

streams.Add(s);

urlAccessParameters.Remove("rs:PersistStreams");

urlAccessParameters.Add("rs:GetNextStream", "True");


 


do

{

s = rview.ServerReport.Render(format, deviceInfo, urlAccessParameters, out mimeType, out extension);


if (s.Length != 0) streams.Add(s);

}


while (s.Length > 0);


 

It's not the most elegant of solutions but it gets the job done.

måndag 11 oktober 2010

ReportViewer Web Control Issues

We have a developed SQL Server ReportViewer webpart for MOSS 2007 and WSS 3.0. The webpart is nothing fancy, basically just a wrapper around the ReportViewer web control that comes with Visual Studio 2008, but it allows us to customize it somewhat.

The problem arose when one client noted that the reports don't scroll to the expanded row when using drill down in SSRS - really annoying for the users! The drill down was a standard visibility toggle so it should work, and indeed it was fine if you accessed the report directly from the report manager.

I didn't really find anything when googling, except that using the asynchronous rendering mode would solve it, or upgrading to the ReportViewer from Visual Studio 2010. Async rendering has its own peculiarities and was not an option at this stage and neither was changing the development environment.

The solution turned out to be quite simple, although a bit "hackish". I reduced the problem to a simple webform with only the webcontrol on it. That allowed me to realize that the webcontol indeed tries to scroll to the expanded item by rewriting the hash part of the URL. However it seemed that the IDs that the hash part (does it have an official name? must investigate…) pointed to were rewritten. Most likely because it's included as a web control. Long story short: peering over the generated code I realized that the IDs had a prefix but they still ended with the hash part. Using a bit of jQuery solved that part:


setTimeout("Jump()", 2);

function Jump() {

var hash = window.location.hash;

hash = hash.substring(1, hash.length); // remove the #

if (hash != "") {

var hash2 = $("div[id*='" + hash + "']").attr('id');

window.location.hash = hash2;

}

}


The time out was needed becasuse the hash was written by another javascript and we had to wait for it to finish.

lördag 13 februari 2010

Sharepoint jQuery

Deep in a Sharepoint project at the moment.
The idea of extending Sharepoint with jQuery really piqued my interest and I think it might be useful for our scenario. I compiled some links I need to read to get up to speed on this, I will add to this if I find more of interest.
  • http://blogs.technet.com/vedant/archive/2009/02/08/jquery-and-sharepoint-2007.aspx
  • http://philwicklund.com/archive/2009/04/20/an-introduction-to-jquery-for-sharepoint-developers.aspx
  • http://searchwinit.techtarget.com/tip/0,289483,sid1_gci1366874,00.html
  • jQuery Test Panel for SharePoint

måndag 18 januari 2010

Ctrl-n No Longer Opens A New Query in SSMS 2008

Just found the answer to one of those little annoyances, you know. As of version 2008 Sql Server Management Studio does not respond to ctrl-n anymore. It has really bugged me but now I know how to fix it.

Change the keyboard layout to "SQL Server 2000" and then back to "Standard" and that will restore the default keyboard mappings.

http://anotherlab.rajapet.net/2009/03/getting-back-ctrl-n-shortcut-with-sql.html

fredag 15 januari 2010

Delayed Windows Service start, a workaround for a Reporting Services 2008 startup bug.

After a clean installation of MS SQL 2008 with Reporting Services running on a Windows server 2003 machine, you may get the following errors in the event log

Event Type: Error
Event Source: Report Server Windows Service (MSSQLSERVER)
Event Category: Management
Event ID: 107
Date: 2010-01-15
Time: 13:07:15
User: N/A
Computer: VIRTUALWSS
Description:
Report Server Windows Service (MSSQLSERVER) cannot connect to the report server database.



What happens is that the SSRS service gets started to early and tries to connect to the SQL database, which not has entered a state ready for handling connections. However the reporting service retries and starts successfully, despite the errors that have been logged.

The bug is reported to Microsoft SQL team, see ID 377627, but will not be fixed. The supposed solution to the problem is to use Service dependences ; however that does not work for me.

My solution is to create a batch file that after a specified delay starts the reporting services service.

  1. Create a directory named "C:\Scripts".
  2. Run "notepad C:\Scripts\DelayedReportServer.bat " and copy-paste the following into the file:

    @echo off
    ping -n 60 127.0.0.1 >NUL
    net start ReportServer

    This will start the ReportServer service after an 60 seconds delay (ping is used only to generate the delay).
  3. Start a new CMD session.
  4. Now you should create a service named "SQLDelayedReportServer" using the instsrv.exe and srvany.exe tools. Run the following command:
    Instsrv.exe SQLDelayedReportServer "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
  5. Using regedit.exe, open the key:
    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLDelayedReportServer"
  6. Create a new key named "Parameters"
  7. Under the "Parameter" key, create a new String value named "Application". Set its value the batch file you created (C:\Scripts\DelayedReportServer.bat). You should now have something like this:
  8. Now start the Service manager (Start->Administrative tools->Services).
  9. Set the startup type of "SQL Server Reporting Service" to Manual.
  10. Make sure that the startup type of SQLDelayedReportServer is set to Automatic.
  11. Reboot and hopefully will your Report Server start without any errors. If you still get the errors, try increase the delay in "C:\Scripts\DelayedReportServer.bat".

Reference:

How To Create a User-Defined Service

tisdag 24 november 2009

Swedish SQL Server User Group

Just wanted to let you know that the Swedish SQL Server User Group (SQLUG.se) is making a comeback after hibernating for some time. Can't say I was too active the last time around but I'm planning to change that now. They're kicking it off with a meeting featuring Kalen Delaney as a speaker so it should be prove interesting enough.