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....

Sonntag, 9. Dezember 2007

Use of Printers/Trays/Papers with Rave

Today I'll describe the basics of printer-control in a Delphi application with Rave (possible with all versions of Rave 3.x-7.x and BE/BEX!).

A lot of Rave-user haven't realize that Rave can manage the destination of the print result with out the way of the printer-class, especially the choice of the bin/tray ...

Of course, you can use function like the following to read out the tray from you printer-driver and develop a solution
....
GetPrinter(ADevice,ADriver,APort,hDMode);
pDevMode := nil;
Res := DeviceCapabilities(ADevice,APort,DC_BINNAMES,PCHAR(@(bin[0][0])),pDevMode);
....

But there is an easier way with Rave.
Nevrona Designs have built a "Printer device manager class" called RpDevice.
Insert RpDevice in your uses and then you can work with RpDev.
This function return the current RPDevice object for manage the printer in your app.

RpDev.InvalidPrinter is the first command and with this you can check on the user-machine if there is a correct printer installed or not, e.g. on some servers with running applications aren't installed any printer.

RpDev.Device shows the (selected) printer and RpDev.Printers shows the installed printers on the system.
RpDev.Bins read the installed trays for the selected printer.
RpDev.Papers for the papers (from the driver)

I use Duplex-Mode where ever I can...
With RpDev.SupportDuplex exits an easy way to check if the printer(driver) support duplex or not...

The previous commands only read informations, with RpDev.Select... you can define the destination printer, tray, paper and more

RpDev.SelectPrinter(ComboBox1.Text, true);

To save properties on the printer in the OS you can use RpDev.SaveToPrinter;

Before you execute a report you should define all the things in your code and the result is as expected .

In the RpDev-class you'll find many more and I hope I've opened the door to the possibilities!

Dienstag, 13. November 2007

A new virtualization player is on the horizont...

I develop in the meantime virtual, meaning I have on my workstation (an Intellistation with Dual-XEON 3,2 GHz and 4 GB RAM) for the XP-Prof-System with RAD Studio 2007 a SCSI-Ultra-320 solution with two 15k-harddrives and for the Windows 2003-Server a Firewire-800-system; it works under VMWare Server 1.0.4. The backup is on a USB2-HDD and I think this is a highly performance solution. I tested the MS-solution but the VMWare is in my IMO faster..
And today I received the info hat there is till tomorrow another player in the virtual-world (not the 2nd-life ): Oracle ....
Oracle VM is "is three times more efficient than other server virtualization products", wooow this is a big promise.... and:
"Oracle VM software is available for free download."

There are some interestings things of Oracle VM in the doc's:
"System Requirements
Oracle VM installs directly on server hardware and does not require a host operating system."
this means no guest-os-layer....

from the FAQ:
Who can use Oracle VM?
Any user can get Oracle VM and associated support from Oracle whether they use Oracle products or third party applications.

I wonder about the first impressions of this virtual-solution in the next days on my workstation....
Oracle VM can be freely downloaded starting Wednesday, November 14, 2007 at oracle.com


Dienstag, 6. November 2007

Namespaces and Types of the .net framework 3.5

I've done in the past few weeks some small projects with win32 (I know, it's death but it really works, believe me) and if I need things from the .net-world I've written the assemblies and application in BDS2006 and RAD2007 and it works fine, e.g. I noticed that the log-file from the Microsoft Fax solution in WinXP is Unicode and to read information I made an .net-application. The main application use this "translated" information in non-Unicode.

Today I noticed that there is a new poster from Microsoft.com about the namespaces and types in .net 3.5 (actually 2.x ) here available:
.net-Namespace-pdf-file

-> I think we must be on the top of any changes in the .net-world but it can co-exists with Win32-development and with Delphi we have both worlds, the old, stable and the new (not un-stable!) for our daily work.