473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

am trying to run a programme which is using PGPLOT.When I call it from browser I get

I am trying to run a programme which is using PGPLOT.When I call it from browser I get following error message.
--------
%PGPLOT, Unable to read font file: grfont.dat %PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat file. %PGPLOT, PGENV: no graphics device has been selected %PGPLOT, PGBBUF: no graphics device has been selected %PGPLOT, PGMTXT: no graphics device has been selected %PGPLOT, PGMTXT: no graphics device has been selected %PGPLOT, PGMTXT: no graphics device has been selected %PGPLOT, PGEBUF: no graphics device has been selected
----------
grfont.dat file is on on my system under c:\XAMPP\perl\lib and I have set it as enviorment variable PGPLOT_FONT.
Any help will be much appreciated.
Thanks,
Apr 16 '10 #1
7 4100
numberwhun
3,509 Expert Mod 2GB
Maybe you can shed some light on this, but how is this a Perl problem? If you are coding something to run it using Perl, then you need to please post your code here. If not, I will have to move this question to a more suitable category.

Regards,

Jeff
Apr 18 '10 #2
hanks for your response.Sorry if I didn't explain it properly.Yes I am using a perl script.
In fact it works fine from the command line but only when I call it from browser.I get this error.
Even I tried to add the enviorment variable to code itself
$ENV{PGPLOT_FONT} ||= 'c:\XAMPP\perl\lib\grfont.dat';
But it still cannot pick it.
if you need more info.Please let me know.
Thanks,
Bilal
Apr 18 '10 #3
numberwhun
3,509 Expert Mod 2GB
We are going to have to see your script if we are going to help you. Even then there are no guarantees, but at least we will have a better idea of what you are trying to do.

Regards,

Jeff
Apr 18 '10 #4
@numberwhun
Expand|Select|Wrap|Line Numbers
  1. #!"C:\xampp\perl\bin\perl.exe" -w
  2.  
  3. # TRG:    Perl Script to plot graph using PGPLOT
  4. #     the output is sent to a UUID named file in WWW/tmp directory
  5.  
  6.  
  7. use strict;
  8. use Time::Local;
  9. use Time::Piece;
  10. use Time::Piece::MySQL;
  11. use DBI;
  12. use Data::Dumper;
  13. use Switch;
  14. use POSIX;
  15. use CGI qw(:standard);
  16. use CGI::Carp qw(fatalsToBrowser);
  17. use PGPLOT;
  18. use Algorithm::CurveFit;
  19. use strict; use warnings;
  20.  
  21. print "Content-type: text/html\n\n";
  22. print Dumper(\%ENV);
  23. $ENV{PGPLOT_FONT} ||= 'c:\XAMPP\perl\lib\grfont.dat';
  24. my $database = 'prism';
  25. my $username = 'prism_user';
  26. my $password = 'pr1sm_pass';
  27.  
  28. # Default patient to simplify rapid testing
  29. my $patient_forename = 'random';
  30. my $patient_surname  = 'test';
  31.  
  32.  
  33. # Retrieve graph types and time limits from GET ?
  34. my $start_time = param("from");
  35. my $end_time   = param("to");
  36. my $graph_type = param("type"); # day week or time
  37. my $patient_id = param("pid");
  38. # Diagnostic output
  39. print "Graph for pid=${patient_id}, type=${graph_type}, from=${start_time}, to=${end_time} <br>\n";
  40. # connect to databse
  41. my $dbh = DBI->connect(('DBI:mysql:' . $database), $username, $password)
  42.           || die "Database Connection Failure: $!";
  43.           # find patient
  44. my $patient;
  45. if ($patient_id)
  46.   { $patient = get_patient_byid($dbh,$patient_id);}
  47. else
  48.   { $patient = get_patient_byname($dbh,$patient_forename,$patient_surname); }
  49.  
  50. # get reading dates[0] and value[1] as a structure
  51. my @readings = get_readings($dbh,$patient, $start_time,$end_time);
  52. my @limits = get_current_limits($dbh,$patient);
  53.  
  54. # done with the database
  55. $dbh->disconnect();
  56. # GPAPH USING PGPLOT
  57.  
  58. my $xmin = 0;
  59. my $xmax = 1;
  60. my $ymin = 0;
  61. my $ymax = 32;  # TRG 26Aug08 changed to 32
  62. my $xlabel = 'X';
  63.  
  64. # Set X-axis range and labelling appropriate to graph_type
  65. switch ($graph_type) {
  66.   case "day"  { $xmin=6; $xmax=24+6; $xlabel='hours in day';}
  67.   case "week" { $xmin=1; $xmax=8;  $xlabel='days of week';}
  68.   case "time" { $xmin=$start_time; $xmax=$end_time; $xlabel='date-time'; }
  69.   else   { print "ERROR: Unrecognised graph type\n" }
  70. }
  71. # Initialise PGPLOT
  72.  
  73. #pgbegin(0,"${output_path}${output_file}/PNG",1,1); # 1,1 is number of x,y subplots
  74.  
  75. pgenv($xmin,$xmax,$ymin,$ymax,0,0); # final number -1 for no axes..
  76.  
  77. pglabel($xlabel,'Glucose, mmol/L',$graph_type);
  78.  
  79.  
  80. # ----------------------------------------------------------------------
  81.  
  82.  
  83. # Search for patient-ref given forename and surname
  84. sub get_patient_byname { # (handle,forename,surname) returns patient-ref
  85.     my $dbh = shift;
  86.     my $forename = shift;
  87.     my $surname = shift;
  88.  
  89.     my $query = $dbh->prepare(
  90.         "SELECT * FROM patients WHERE p_forename = ? AND p_surname = ?");
  91.  
  92.     print "Looking for patient by name ($forename $surname)\n";
  93.     $query->execute($forename,$surname);
  94.     my $patient = $query->fetchrow_hashref()
  95.         || die "coulnt find patient\n";
  96.     $query->finish();
  97.     return $patient;
  98. }
  99.  
  100.  
  101. # Search for patient-ref given pid
  102. sub get_patient_byid { # (handle,pid) returns patient-ref
  103.     my $dbh = shift;
  104.     my $pid = shift;
  105.  
  106.     my $query = $dbh->prepare(
  107.         "SELECT * FROM patients WHERE pid = ?");
  108.  
  109.     #print "Looking for patient by ID($pid)\n";
  110.     $query->execute($pid);
  111.     my $patient = $query->fetchrow_hashref()
  112.         || die "coulnt find patient\n";
  113.     $query->finish();
  114.     return $patient;
  115. }
  116.  
  117.  
  118.  
  119.  
  120. # get patients readings within date range as (dtg,value)
  121. sub get_readings { # (handle,patient-ref,start_time,end_time) returns readings
  122.     my $dbh = shift;
  123.     my $patient = shift;
  124.     my $start_time = gmtime(shift);
  125.     my $end_time = gmtime(shift);
  126.     my $pid = $patient->{'pid'};
  127.     my (@results) = ();
  128.  
  129.     my $query = $dbh->prepare(
  130. #        "SELECT meter_dtg, value FROM readings ".
  131. #    "WHERE pid = ? AND meter_dtg>=? AND meter_dtg <=?");
  132.  
  133.         "SELECT meter_dtg,value,lo_val,hi_val,lo_avg,hi_avg FROM readings,limits ".
  134.     "WHERE readings.lid = limits.lid AND readings.pid = ? AND meter_dtg>=? AND meter_dtg <=? ".
  135.     "ORDER BY meter_dtg");
  136.     # note that there are two PID fields
  137.  
  138.     $query->execute($pid,$start_time->mysql_datetime,$end_time->mysql_datetime);
  139.     while (my @ary = $query->fetchrow_array())
  140.     {
  141.        push(@results, [@ary]); # store the reference
  142.     }
  143.     $query->finish();
  144.  
  145.     #print Dumper(@results);
  146.     return @results;
  147. }
  148.  
  149.  
  150. sub get_current_limits { # (handle,patient-ref) returns current limits for patient
  151.     my $dbh = shift;
  152.     my $patient = shift;
  153.     my $pid = $patient->{'pid'};
  154.     my (@results) = ();
  155.  
  156.     my $query = $dbh->prepare(
  157.         "SELECT lo_val,hi_val,lo_avg,hi_avg FROM limits,patients ".
  158.     "WHERE limits.lid=patients.current_lid AND patients.pid=?");
  159.  
  160.     $query->execute($pid);
  161.     while (my @ary = $query->fetchrow_array())
  162.     {
  163.        push(@results, [@ary]); # store the reference
  164.     }
  165.     $query->finish();
  166.  
  167.     #print "<<<<<". Dumper(@results) .">>>>>>><br>\n";
  168.     return @results;
  169. }
  170.  
Apr 18 '10 #5
numberwhun
3,509 Expert Mod 2GB
@bamusic You will probably notice that I have deleted the thread you created today. Creating a new thread with the same content is called creating a duplicate thread. If you are not getting a reply, then keep the thread active and ask if anyone has a suggestion.

I took a look briefly, but am not sure why you are having the issues you are. Hopefully someone will respond to you, but please refrain from creating duplicate threads as it makes more work for those of us maintaining the site, who have to clean it up.

Regards,

Jeff
Apr 20 '10 #6
@numberwhun
Sorry about that.I actually was posting few forums and probably lost the site.
Apr 21 '10 #7
You probably have this fixed by now, and I'm by no means an expert, but I've noticed you've commented out your pgbegin line. There is no device set for pgplot to know where to plot to.

Line 73 #pgbegin(0,"${output_path}${output_file}/PNG",1,1); # 1,1 is number of x,y subplots
Jun 11 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dennis Hore | last post by:
I'm trying to install Nick Patavalis' ppgplot package on Mac OS X 10.3 with python 2.3. I first sent this message to Nick, but he said he doesn't have any experience with the Mac platform. ...
0
by: cm012b5105 | last post by:
Hello i want to put an interactive text programme in to a graphical box this is a small section of my text programme s = raw_input ("Hello whats your name? ") if s=='melvyn': print "your my...
0
by: melledge | last post by:
Full Programme for XTech 2005 Announced Premier European XML Industry Event Expands Focus to "XML, the Web and Beyond"; Co-hosted by the Mozilla Foundation,W3C, and OASIS, Presenters Include...
4
by: Mark J. McGinty | last post by:
Greets, Part of the content of one of our web pages uses wingdings and Chr(239) through Chr(242) (which are little arrow outlines, though that's not really important.) It worked just fine in...
2
by: Bart Schelkens | last post by:
Hi, I'm writing an ASP.Net programme (using VB.Net) When I press F5 to run and debug, i get the message : Error while trying to run project. Would you like to disable future attempts to debug...
2
by: Randall Parker | last post by:
Some questions on forms authentication: 1) Can one do one's own checking of username and password and totally bypass calling FormsAuthentication.Authenticate? 2) does the "new...
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
18
by: arnuld | last post by:
i compiled the "hello world" programme from K&R2: #include<stdio.h> int main() { printf("hello world\n"); }
6
by: chang | last post by:
Hi ALL, I am working in C from past few months. Still now i can't figure out who is called main() in 'C' programme? Main() is a function from that we can call our sunroutines but someone has to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.