Tuesday, 10 October 2006
A generic Swap function
if i ever forget how to write this function then... well, let's hope i never do. i was really surprised not to be able to find it in the SDK. i'm posting it here for reference anyway. note: this can only be used in .Net 2.0 which supports generics.
Tuesday, 10 October 2006 16:55:31 (GMT Daylight Time, UTC+01:00) .Net General
/// Swap 2 objects
public static void Swap<T>(ref T first, ref T second)
T tmp = first;
first = second;
second = tmp;
Saturday, 07 October 2006
HowTo: Deploy Crystal Reports for VS 2005
i found this insanely difficult because none of the supposedly normal options worked. merge modules didn't seem suitable because i just wanted to install the CR dlls once and for all on the server. according to an MSDN2 article
i should be able to perform a windows installer deployment, but of course when i copy the key code from the VS2005 > Help > About dialog, and use it in the installer on the server, the error message is that the key code has expired or is invalid. 'business objects' appear to be forcing users into an upgrade path for their new product, by claiming that a 'compatibility upgrade' is required for VS 2005, which of course you have to fork out for. such a load of crap.
anyway, what eventually worked for me was to go back into my VS 2005 dev machine and create a web set up project. go into the project properties and click the prerequisites button, select CR for .Net 2.0 and then just build the empty setup project. if you look in your output folder, there is an installation file called CRRedist2005_x86.msi. Just whack this onto the server and your crystal reports should run fine, i didn't need to reboot or restart IIS. Note there is no also need to copy any of the CR dlls to your web site bin folder.
yet another miserable failure for crystal reports!
Saturday, 07 October 2006 01:32:30 (GMT Daylight Time, UTC+01:00) .Net General | Asp.Net | Windows Server
Thursday, 05 October 2006
HowTo: Automate SQL Express Backup
There is a thoroughly excellent article about this on the SQL DBA Tips web site. Don't forget to enable modify permissions for the account that is running SQL Express, e.g. Network Service.
just posting it here in case i ever forget where it is.
Thursday, 05 October 2006 11:31:25 (GMT Daylight Time, UTC+01:00) Database
Friday, 08 September 2006
Wednesday, 06 September 2006
FIX: VS2005 Unrecognised tag prefix or device filter
I encountered this error after upgrading a web site to VS2005 and converting it to a Web Application Project. the project built without problems, it was just the designer kept throwing up errors in the error list which was very annoying.
Thanks to 'ratureus' for his post on http://forums.asp.net/thread/1212425.aspx
- Close VS 2005
- delete all files in C:\Documents and
- Restart VS 2005
this worked for me.
Wednesday, 06 September 2006 11:50:04 (GMT Daylight Time, UTC+01:00) Asp.Net
Tuesday, 05 September 2006
PDF problems: File does not begin with %PDF
I use exported crystal reports in PDF format on my web site, and i was getting intermittent errors from a small number of users. I couldn't reproduce it, and i found a thoroughly excellent article on the problem at the Fluid Components International
They explain what's going wrong and have some suggestions to fix it. I suspect in my case it was a problem with embedding the PDF in an activeX control. i'll just redirect users to download the file instead.
Tuesday, 05 September 2006 15:29:49 (GMT Daylight Time, UTC+01:00) Asp.Net
Wednesday, 30 August 2006
Wednesday, 30 August 2006 17:12:43 (GMT Daylight Time, UTC+01:00) Asp.Net
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
<textarea maxlength="40" onkeyup="return ismaxlength(this)"></textarea>
Wednesday, 16 August 2006
Global country list
i took this off Wikipedia
and trimmed it down to plain text for a database. just posting it here for reference:
You may be more interested in the ISO official list of countries
and their 2-digit codes.
SBA Akrotiri and Dhekelia
Antigua and Barbuda
Saint Helena Ascension Island
Bosnia and Herzegovina
Central African Republic
Cocos (Keeling) Islands
Isle of Man
Northern Mariana Islands
Papua New Guinea
Pridnestrovian Moldavian Republic
Saint Kitts and Nevis
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
São Tomé and Príncipe
Trinidad and Tobago
Tristan da Cunha
Turks and Caicos Islands
United Arab Emirates
Virgin Islands (British)
Virgin Islands (United States)
Wallis and Futuna
Wednesday, 16 August 2006 16:39:04 (GMT Daylight Time, UTC+01:00) .Net General | Asp.Net | General
Friday, 11 August 2006
Crystal Reports: Export PDF irregularities between server and dev machine
I have a few reports in my web application that i export in PDF format only. You would think this would remove any printer driver complications but apparently not.
Crystal Reports have a surprisingly good article
to help troubleshoot issues with printing or exporting a report.
The problem i was finding was that in a Text object or Unbound field, the text would be truncated at the edge of the box boundary. Some users have reported strange mid-word wrapping, but mine was a different problem, actually hacking off the end of each line. This didn't happen on my dev machine, but it did happen on the server (2003). When i compared them side by side, the Times New Roman font on the server was stretched by about 5% compared to my dev machine.
with the help of the CR article, i tracked it down to the lack of any printer installed on the server, i had also disabled the Print Spooler service which was preventing even the Microsoft Office Document Imaging Printer from being available. So i started the print spooler service and made sure that the Office Imaging Printer was marked as the default printer. Then i went back to Visual Studio and set all the reports to use the Office Imaging printer. This solved the problem.
You could of course install a PDF only printer such as PrimoPDF if you didn't have MS office installed on the server. As long as the server has the same printer installed as the one set in the report design, everything turns out fine.
Friday, 11 August 2006 13:20:57 (GMT Daylight Time, UTC+01:00) .Net General | .Net Windows Forms | Asp.Net
Thursday, 10 August 2006
Crystal Reports: join / concatenate null strings
I was getting blank fields in my crystal report if one of the values in the formula was null.
Thanks to this post
i know better than to trust Crystal's crummy concatenation rules. Here is what
had to say:
A string concatenated with null always gives null.
Thursday, 10 August 2006 17:31:20 (GMT Daylight Time, UTC+01:00) .Net General | .Net Windows Forms | Asp.Net
You have to check if the first name is null with
if not IsNull(firstname) then
lastname + " " + firstname