Free Pascal on OpenBSD

Finally found it:

# pkg_add fpc

I wonder when I will get actual projects done. I’ve heard the quote, “Never learn Linux on work time, because the learning process is supposed to be fun.”

FPC itself, on Windows, opens into a mode that reminds me of QBASIC. Good times. I can be a kid again. Pascal is used for professional stuff now, but this small piece of me can stay curious and content.

Advertisements

Handheld brush

Early in “Software Tools for Pascal,” the authors refer to chapter 3 and the Appendix for organizing code. The first program, one to print whatever is typed, is shown as a complete work, with definitions for getc(), putc() and a main procedure. Later, the utility procedures are placed into their own source files. We write a program to handle #include directives!

That alone made me feel less lost than the first edition. The Appendix really helps set up a template for programs: all the #includes, the constants, etc. Only in game engines have I seen each ASCII character assigned a value; now I can have the fun of specifying them.

Unfortunately, overstrike() and tab/detab are included. No pipe example in the initial chapter, either. That’s okay, though. Everything looks more C-like and thus friendlier.

Expert reasons

I’m glad I didn’t listen to the reviewers for “Software Tools in Pascal,” or even Kernighan’s “Why I Don’t Like Pascal.” The decision point was between “this book is more semantically C” versus “the original book is better.” Well, I had the first book and ratfor77 was convulsing during make.

I’m glad I bought the book, because otherwise I wouldn’t have had permission to do this:

arr[0] = '#'
arr[1] = 'i'
arr[2] = 'n'
arr[3] = 'c'
arr[4] = 'l'
arr[5] = 'u'
arr[6] = 'd'
arr[7] = 'e'

Inwardly, I felt like this kind of idiom would be a sin. That shows how inexperienced I am with languages where strings are built piecemeal. You make do with what you have; in this case, an early chapter, a new reader, and a seasoned pedagogy.

Outlook rule suddenly fails

An Exchange upgrade doled out default 32 kb rules limits to everyone, but I needed more. It was a simple fix on the admin side, and I was back to normal operation. Fortunately, I did not have to add “stop rules processing” to every rule. That kind of global update reminds me of when scheduled tasks started failing, and I made drastic, sweeping changes to later undo.

It reminds me of how fragile the journeyman’s spaceship is, patched with tape and hardpoints cheaply slotted. We romanticize it heavily – the independent, scrappy cruiser-nobody – without really evaluating the risks. We want adventure in our space operas!

Maybe the fine point is a balance between Every Item Important and Death Comes Easy. In rogue-likes, experienced players seem to make every expense count, even as their treasure appears completely random. Being resourceful is a prerequisite for adventurers.

User-side wisdom

A page wouldn’t render correctly in Internet Explorer 11. I proposed three workarounds:

  • a proxy server to forward requests
  • use a Microsoft-supplied virtual machines (VM)
  • uninstall IE11 and install IE10 or older

The first solution would have required web scripting and another application. The second would have consumed bandwidth, once to grab 2 GB or so for the images, and across the network per user. The third required digging into Control Panel, which was straightforward but left the user with a dilapidated browser.

The best approach was to use Compatibility Mode, built into IE11. I didn’t know because I didn’t have it, and I rarely visited those pages. This is an example of jumping to novel ideas instead of trying the most practical thing first.

Zero-byte files exist

This file got created regardless of perl’s output:

perl some-script.pl > file.txt

rem always true
if exists file.txt (
...
)

The batch script continues since the file always exists, even if there is no content. So instead I used

for /f "tokens=3" %%i in ('dir /-C file.txt') do (
  if %%i==0 (
    echo error
    exit /b 1
  )
)

(99) dupes

Outlook will keep up to n+1 copies of duplicate attachments, up to <filename> (99), and after that complains of permissions error. Searching the registry for the key “OutlookSecureTempFolder” should give the directory path.

The easiest workaround for the future is to append the date to the filename; that’s enough to make each attachment unique.

Dramatica 4.0 in qemu (Windows XP)

Installing Windows XP in qemu using instructions from Cromwell was straightforward. The only difference was invoking qemu-system-i386 instead of qemu. Here are some pointers for setting up Dramatica 4.0 after Windows XP:

  • Shutdown the computer and (q)uit qemu. Remove the Windows XP CD and put the Dramatica 4.0 CD into the CD-ROM drive.
  • Start up Windows XP with qemu-system-i386 xxx (options from Cromwell). The D:\ drive should be recognized. Dramatica 4.0 can now be installed.
  • For Dramatica 4.0 registration, go to “Print and mail” and then Cancel. Then click “Never Register.”
  • Scroll wheel doesn’t work, at least out of the box.
  • After installing Dramatica 4.0, remove the installation CD from the CD-ROM drive. qemu-system-i386 will not run with no CD and with -cdrom flag set, so remove the -cdrom flag before running the command.

Physical hardware: AMD FX 4300 quad-core CPU, Radeon 7000 64 MB graphics card, 1 GB DDR3 RAM

TODO

  • Turn off Windows Activation.
  • Try WINE.
  • Move and copy files to/from .hd file.

qemu-xp

pkg_add: cannot find package, OpenBSD::Quirks

I started xterm and edited .profile to have a PKG_PATH:

# xterm
# vi .profile
PKG_PATH=http://path.to/mirror/pub/OpenBSD/5.6/packages/amd64
# exit

And then started a new xterm window to have the new environment variables. But I still could not add packages, including gfortran, firefox and qemu. pkg_add -vvvvv recommended installing “OpenBSD::Quirks,” which wasn’t available on cpan.

Workaround was to install Firefox from the CD, which includes “quirks” package:

# mkdir /mnt/cdrom
# mount /dev/cd0a /mnt/cdrom
# PKG_PATH=/mnt/cdrom/5.6/packages/amd64
# cd $PKG_PATH
# pkg_add firefox-31.0.tgz
# exit

I started a new xterm and tried to add packages over HTTP, but it still failed. I was missing the export statement in .profile:

# vi .profile
export PKG_PATH

CPUs only accept certain types of RAM

I have a board that accepts both types of modern RAM and a few likewise sockets, but the CPU’s hardware controller dictates what’s really allowed. I put in a quad-core but didn’t get display with the new memory stick. According to forums, this particular CPU does not work with DDR2.

More of the waiting game. I feel okay about it, as if I’ve deferred a certain burden to circumstance. Figuring out a bottleneck without the reading of a book, as it were: diagnosing hardware is a hands-on thing.

The nearby computer store has changed. I’ve never seen such towers in my life. Getting there I passed a building with propped walls, concrete to later turn into a warehouse. I know because one made progress with each day, and finally a sign was put out for rent.