header image
The world according to David Graham

Topics

acva bili chpc columns committee conferences elections environment essays ethi faae foreign foss guelph hansard highways history indu internet leadership legal military money musings newsletter oggo pacp parlchmbr parlcmte politics presentations proc qp radio reform regs rnnr satire secu smem statements tran transit tributes tv unity

Recent entries

  1. Why do lockdowns and pandemic restrictions continue to exist?
  2. Parliamentary privilege: an arcane concept that can prevent coups
  3. It's not over yet
  4. Trump will win in 2020 (and keep an eye on 2024)
  5. A podcast with Michael Geist on technology and politics
  6. Next steps
  7. On what electoral reform reforms
  8. 2019 Fall campaign newsletter / infolettre campagne d'automne 2019
  9. 2019 Summer newsletter / infolettre été 2019
  10. 2019-07-15 SECU 171
  11. 2019-06-20 RNNR 140
  12. 2019-06-17 14:14 House intervention / intervention en chambre
  13. 2019-06-17 SECU 169
  14. 2019-06-13 PROC 162
  15. 2019-06-10 SECU 167
  16. 2019-06-06 PROC 160
  17. 2019-06-06 INDU 167
  18. 2019-06-05 23:27 House intervention / intervention en chambre
  19. 2019-06-05 15:11 House intervention / intervention en chambre
  20. 2019-06-04 INDU 166
  21. 2019-06-03 SECU 166
  22. 2019 June newsletter / infolettre juin 2019
  23. 2019-05-30 RNNR 137
  24. 2019-05-30 PROC 158
  25. 2019-05-30 INDU 165
  26. 2019-05-29 SECU 165
  27. 2019-05-29 ETHI 155
  28. 2019-05-28 ETHI 154
  29. 2019-05-28 ETHI 153
  30. 2019-05-27 ETHI 151
  31. older entries...

October 27th, 2002 (from Advogato)

@echo off
mem/d|find/i "ANSI">nul
if errorlevel 1 goto :error
echo %0%1%2%3%4%5%6%7%8%9|find/i "/?">nul
if not errorlevel 1 goto :help

The opening lines to boggle, as I wrote it in DOS .batch in highschool.

Remember batch files?

They were the only redeeming feature of DOS. They allowed me to learn basic coding skills without getting any kind of compiler or trying to squeeze Linux onto my XT or my PS/2 (personal system, that is, not playstation).

There were only a couple of things you couldn't do without getting additional binaries not included in a basic DOS system.

Mainly, you couldn't sleep, and you couldn't read the keyboard once the "program" was already in progress. To solve these, I used a small file called "keytrap.exe" which was a whopping two or three lines long written for me by an acquaintance with a compiler named Chris Micali, and two small files called getkey.com and getscan.com which were 8 and 10 bytes respectively, and sleep.exe which I got off shareware.com eons ago, and have long since lost the associated license file.

With those tools I spent entirely too much time writing batch files throughout my years at NMH.

For the sake of sheer, morbid curiosity, I've posted a small selection of these batch files here. I strongly recommend NOT running any of them without backing up and quarantining your archaic little DOS box.

Note the existence of "random" number generation in some of those files, particularly the game of boggle.

alias.bat was my attempt to have something with similar functionality to alias in a variety of un*x shells. I had shell access from the computer labs and found this to be a useful little tool missing in DOS. Careful though, alias is a self-installer which makes sure ANSI.SYS is loaded and burrows itself in its own directory.

Once I finally bought a Linux-capable box, I was disappointed to learn that random numbers could be obtained across a large range using a single line in bash - rather than the 200 lines with a limited range of 1 to 100 found in batch - and that reading keyboard input and sleeping could be done without batting an eyelash.

It took all the fun out of scripting.

*sniff*

Posted at 17:42 on October 27, 2002

This entry has been archived. Comments can no longer be posted.

September 26th, 2002 (from Advogato) | foss | November 30th, 2002 (from Advogato)

(RSS) Website generating code and content © 2001-2020 David Graham <david@davidgraham.ca>, unless otherwise noted. All rights reserved. Comments are © their respective authors.