nyctergatis.com
 
Contact

Projects
Sysquake Remote Live
NME
PDF
Sudoku
EAN Barcode
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS

en fr

Sysquake Remote

EAN Barcode

This little Sysquake Remote application displays the barcode corresponding to a 8-, 12- or 13-digit code. 13-digit codes are EAN-13 (European Article Number) barcodes used everywhere for marking goods; 8-digit codes are EAN-8 barcodes, less common; and 12-digit codes are UPC barcodes (Universal Product Code), a subset of EAN-13. For all code sizes, the last digit is a checksum. If you enter a non-digit character, Sysquake Remote will compute it for you.

Code:

Full code: 1234567890128

Source code

Here is the code inserted in the file stored on the server. If you look at the source of this page in your browser, you'll see only the HTML code produced by Sysquake Remote.

Library barcode.lml will be provided with the next release of Sysquake and Sysquake Remote.

<?sqr
try
  c = getfield(httpvars,'c');
catch
  c = '123456789012?';
end
?>

<form method="get">
<p class="nojustif">
Code: <input type="text" name="c" size="13" value="<?sqr= c ?>">
<input type="submit" value="Update">
</p>
</form>

<?sqr
use barcode;

if length(c) ~= [8, 12, 13]
  ?><p>Code length must be 8, 12 or 13.</p><?sqr
elseif any(~isdigit(c(1:end-1)))
  ?><p>Code must contain only digits, except for the last
  character which is replaced with the checksum.</p><?sqr
else
  (b, g, num) = eanencode(c);
  beginfigure;
  image(~[repmat(b,10,1);g], 'e');
  plotoption noframe;
  endfigure;
  if ~isdigit(c(end))
    fprintf('<p>Full code: %s</p>', num);
  end
end
?>
Copyright 2008, Yves Piguet and Calerga.
All rights reserved.