Sonntag, 27. Januar 2008

Check for a valid printer on the system

Today I've received an interesting problem with one of my applicatons. On a Win2003-Server the application should crash... I tried to reproduce it on my Win2003-System@home and no problem, the data (over dbx4) - connection and the preview or creation of pdf-files, created with Rave Reports (what else ), works on my system fine. On the WinXP on the customer-side it works, too.
The solution was easy, after I noticed that they haven't installed any printer-driver on the system:

include RpDevice in the uses and then you can check before the rave executes the existence of any printer:

if RpDev.InvalidPrinter then
showmessage('no printer'); -> and you should disable the execute of RvProject in the application

The older way with printers count can make trouble with network printers and isn't recommended (RPDev.Printers.Count).

After installation of a small printer driver (I prefer the HP LJ4 for things like this) the application creates reports with Rave on the customers server without any problems....

Montag, 14. Januar 2008

Reader's Choice 2008

From the german "entwickler magazin" is a new Reader's Choice 2008 available, this remembers me on the"Delphi Informant" Readers Choice a long time ago ....(with TurboPower and so on)

Make your choice (if you work with Rave, make sure, that you check Nevrona Rave Reports for the best reporting tool ) and perhaps you'll win RAD Studio 2007, a ticket for the spring editon of EKON in February in Frankfurt or interesting (german) books....

Dienstag, 8. Januar 2008

Rave and delphipraxis.net

Daniel, the adminstrator of the german delphi forum delphipraxis have published some informations about statistiscs of the forum after more then 5 years (congrat Daniel for this friendly an helpfull place in the internet-world for every delphi-developer; and, yeah, I'm member #488 of this community since "5 Jahre, 3 Wochen, 3 Tage")

Especially interesting is the in the 2nd post the search-word "Rave": 11 !

# Begriff Häufigkeit
1 delphi 31.801
2 string 27.290
3 datei 26.631
4 dll 22.553
5 indy 18.343
6 stringgrid 17.215
7 listview 16.497
8 array 16.260
9 programm 15.410
10 form 15.189
11 rave 13.595
12 listbox 13.292
13 dbgrid 12.568
14 text 12.497
15 löschen 11.949
16 sql 11.535
17 xml 11.408
18 url 11.401
19 auslesen 11.256
.........

If you search for Rave-related problems, questions and solutions ....
look into the delphipraxis (if you have problems with german translate with google)

Rave Reports and problems with (HP) printer drivers...

I read sometimes in newsgroups about problems with Rave and printer drivers, especially HP, e.g. 2600.

The interesting thing is, that the customer can print without any problems with MS-office or other application, but with Nevrona Rave Reports there is a Division by zero exception with some drivers. An update of the driver sometimes solves the problem but not 100%.

With the following solution is a workaround available that create the reports without exceptions.

Try this and if you found another problem (or solution, of course ) in this area, write me an email.

Some programming libraries (and perhaps MS-Office?!) contain such procedure

call: Set8087CW($133f);
this disables FPU exceptions....

Normally there is some bad code (in the driver) that is changing the FPU control word to cause it to ignore some exceptions and not properly resetting it.

The default value of Default8087CW is $1332, with the following code you can check it in your pascal-code.

If (Get8087CW and $1F3F) <> $1332)
then ShowMessage(Format('CW=$%4.4x',[Get8087CW]));

To make your rave-reporting with "every" driver stable, the following code should work;

var
CW: Word;
begin
CW := Get8087CW;
try
Set8087CW($133f);
RvProject1.ExecuteReport('Report1');
Set8087CW(CW);
except
..
end;
end;

or the asm-way

asm
FLDCW cw
end;

with C++ the workaround should be the secureFPU (I’m not the C++-expert, I hope this is correct !?)

#include "float.h";
void secureFpu() { _control87(PC_64|MCW_EM,MCW_PC|MCW_EM);}

Another trick especially for HP-printer driver is setting in the application the SkipAbortProc to true:
RPDev.SkipAbortProc := true;
(you must insert the RpDevice-unit)

Now your customer can print with Rave and don't get an exception....