%plotX_v2.m   plot the letter X
% P. Conrad   for CISC106, 10/16/2007


  % set up cell array
  
  myPlot = cell(2,1);
  
  myPlot{1} = [0 0; 4 8];
  myPlot{2} = [0 8; 4 0];
  

  plotAll_v2(myPlot);
  

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % plot the current plot to the file letterA.jpg 
  % and make it readable on the web
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  dirName = '~/public_html/cisc106/10.16';
  fileName = 'letterX_v2.jpg';
  fullFileName = [ dirName '/' fileName];
  
  system(['mkdir -p ' dirName]);
  
  print('-djpeg', fullFileName);
  
  system(['chmod -R 755 ' dirName]);

  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Print out a URL to access the file 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  % retrieve the current username
  
  [status, myUserName] = system('whoami');
  
  % remove any extra space at start and end of myUsername
  
  myUserName = strtrim(myUserName);
  
  % build the URL by susbtituting ~/public_html with 
  % http://copland.udel.edu/~username inside the dirName 
  
  URLprefix = ['http://copland.udel.edu/~' myUserName];
  theURL = [strrep(dirName,'~/public_html',URLprefix) '/' fileName ];
  
  % print a message with the URL
  
  fprintf('Visit %s to see the plot\n',theURL);

