Random knowledge V.

25 January 2007

GNU Screen makes coding so much easier: Run screen to multiplex your shell, then run a text editor in one, a debugger in another, have another shell open to compile.. no more mousing between windows. There isn't much of a learning curve, if you feel comfortable coding under Unix (or using the Cygwin tools for Windows) you'll pick it up in no time.



Sleeping just enough to recoup your strength so you can go out again isn't a good thing. Sleep enough to get all your energy back. Don't pull two or three all-nighters in a row, either. It'll crush your immune system.

When programming in C++ using the GNU g++ compiler, dynamically allocating a matrix (an array of arrays) isn't obvious. After some research and some messing around, here's how to do it:

int *matrix, i;
matrix = new int
[number_of_rows];
for(i=0; i matrix[i] = new int[number_of_columns];\
}\
\
\
When passing the new matrix to a function or a method, be sure that the prototype is looking for a pointer to a pointer, like this:\
\
\void some_function(int **matrix, int rows, int columns);\\
\
Lastly, when deallocating the matrix, you'll want to reverse the procedure used to allocate it to begin with - deallocate the arrays that make up the rows, then deallocate the array of pointers - the first column.\
\
\for(i=0; i\ delete [] matrix[i];\
}\
delete [] matrix;\
\
\
\
\
When photocopying an article for a class you don't have to copy the article's bibliography as well. Save yourself the time and money.\
\
The same thing goes for printing out articles for classes, too. Figure out where the bibliography starts in the article and stop printing as close as you can to that point. Save a few trees. Save some toner, too, those cartridges are expensive.\
\
Lyssa Heartsong gave me hell for this entry, and if you're using these articles to write a formal paper, like a thesis or a research paper, this is a really bad idea. Don't do it because you need the trail of accountability formed by the sources cited by the author of the article you're citing, but if it's just reading material for a class it should be okay.\
\
\
\
When packing up a given living space, make a careful estimate of the number and size of the cardboard boxes you're going to put stuff in, then buy 1.5 times the number of boxes you think you'll need. Even if you pack the boxes carefully you \will\ find stuff that you didn't remember you had, and you \will\ need something to put it in. Don't forget strapping tape to reinforce them if you buy them in a collapsed state.\
\
\
\
\Nonterraqueous\ for the Commodore 64:\
    \
    \
  • Put joystick in port #2\
  • \
    \
  • 'M' key - toggle music off and on\
  • \
    \
  • 'D' key - drop bomb (note: do this to remove barriers; drop bombs when near\
    the top of the screen and move away as fast as possible to avoid dying)\
  • \
    \
  • space bar - pick up bombs\
  • \
\
\
\
The poor admin's backup, courtesy of SSH and tar: \tar --create --verbose --exclude /proc --exclude /dev / | ssh user@backup-host "cat > /tmp/backup-filename.tar"\\
\
The double-quotes around the final command (cat > ...) are necessary - don't leave them out!



If you're working on a Unix system and you accidentally hit a control+something key combination and your terminal locks up, what you most likely did was hit control+S, which locks your terminal. Keep calm. Hit control+Q to unlock the terminal and put everything right.



Reading God Emperor of Dune by Frank Herbert before writing cover letters is a bad idea. Even if you do conceal everything that you are capable of.



When looking for a job through the PGHtech.org website, don't bother setting any categorical preferences (such as "Management" or "Developers"), just plug in your search terms and work from those. The broadest search terms will give you the best (most, actually) hits.



When running masking tape along the baseboards and doorframes to repaint a room, use short strips of tape, about nine inches each. Cover borders and frames that you don't want painted with it, making sure to overlap the tape a bit to make sure everything's covered. Also, wipe the walls down with a damp rag to get the dust and cobwebs, they'll ruin your paint job. Take your time with it.



How to install a Maxtor hard drive when you need to use the MaxBlast drive overlay software with Windows 2000:

  • Power your deck down and pull the hard drives. Boot and enter the BIOS configuration. For each large drive, set the entry to "none".

  • Reboot and boot the MaxBlast CD-ROM or floppy disk.

  • When you get to the language select screen, pick a language.

  • Select the "Install MaxBlast software" option. The installer will tell you that the drive hasn't been set up and it will ask you to do so. Let it.

  • Reboot your deck - your OS CD should not be in the CD-ROM drive. Let your system boot until the blue banner for the hard drive overlay software comes up. Press 'C' when the banner comes up; you'll be asked to insert a bootable CD-ROM. Put your Windows 2000 CD into the drive and press the space bar.

  • Let the Windows 2000 installer run its course. When the screen asking you which partition to install to comes up, the option to install to a prepared partition should be highlighted. Don't argue, just hit enter. The MaxBlast installer has already formatted that partition with NTFS, don't argue.

  • The Windows installer will start copying files over. When it's done pull the Windows 2000 CD out of the drive and reboot. Your system will boot through the drive overlay and then into the Windows stage two installer.


As long as you don't change the drive layout that the MaxBlast installer built for you, everything will be fine. You must remember to let the system boot to the point where the drive overlay banner comes up or you'll have to start the installation process over.