• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Zakath

#1
Warcraft / What did you do for fun lately?
May 31, 2006, 02:07 PM
#2
Warcraft / CTProfiles
March 25, 2006, 04:48 PM
Relatively new, I believe. Provides a nicer interface than Allakhazam, although it has to be updated manually. Also allows you to show different gear configurations, which is kind of neat. Share yours!

http://ctprofiles.net/36189
#3
Politics / I propose a new political party:
November 22, 2005, 01:26 PM
How about...

The Party For People With Common Sense?

There's a reason I don't regularly post in this forum. Every time I come here, I'm disgusted by the sheer venom in otherwise intelligent peoples' words. I'd rather ignore this place than come to hate you all because you display such a staggering lack of regard for your fellows.

Can we get some bare standards of decency in here? No idea is bad just because of the party that proposed it. All political agendas have their weakness. To claim otherwise is just ignorant. I'd like to see an end to insultingly referring to people and entities because of their particular political affiliation.

How about actually evaluating people's ideas, rather than fixating on the place on the political spectrum they happen to occupy?
#4
Warcraft / Zak comes out
October 23, 2005, 02:50 PM
#6
Fun Forum™ / If a Beholder's guarding it...
June 23, 2004, 08:45 PM


Edit: In case it was unclear, the "Spectator" who is speaking in the above screenshot is the Beholder itself.
#7
C/C++ Programming / Do Zak's homework!
March 01, 2004, 01:19 PM
No, I'm not really asking for you to do it FOR me. In fact, I've already done it. However, if you're curious about what sort of stuff a college CS course might make you do, this topic is for you! Here you can see a couple assignments, followed by their solutions.

Introduction
This assignment is intended to introduce you to the process manipulation facilities in the Unix Operating System. You are to implement the program described below.

Command Execution
You are to write a program doit that takes another
command as an argument and executes that command. For instance, executing:

% doit cat /etc/motd

would invoke the cat command on the file /etc/motd, which will print the current "message of the day." After execution of the specified command has completed, doit should display statistics that show some of the system resources the command used. In particular, doit should print:

1. the amount of CPU time used (both user and system time) (in milliseconds),
2. the elapsed "wall-clock" time for the command to execute (in milliseconds),
3. the number of times the process was preempted involuntarily (e.g. time slice expired, preemption by higher priority process),
4. the number of times the process gave up the CPU voluntarily (e.g. waiting for a resource),
5. the number of page faults, and
6. the number of page faults that could be satisfied from the kernel's internal cache (e.g. did not require any input/output operations)

Basic Command Shell
Your program should be extended to behave like a shell program if no arguments are given at the command line (it should work as before if arguments are given on the command line). Your program should continually prompt for a command (which may have multiple arguments separated by white space) then execute the command and print the statistics. This work will involve breaking the line of text you read into an argument list. Your program should handle two "built-in" commands, which are handled internally by your shell.

exit - causes your shell to terminate.

cd dir - causes your shell to change the directory to dir.

Your program should also exit if an end-of-file is detected on input. You may assume that a line of input will contain no more than 128 characters or more than 32 distinct arguments.

Note: you may not use the system call system available in Unix to execute the entered command.
#9
Gaming Discussion / Need For Speed Underground
January 19, 2004, 06:25 PM


edit: I changed cars ;)
#10
C/C++ Programming / C++ can do anything!
November 20, 2003, 06:01 PM
As an example, I've duplicated the functionality of the VB Mid function and statement. The error-checking is a little weak since I didn't spend a ton of time on it, but it works perfectly when all input is valid.


#include "stdlib.h"
#include "stdio.h"
#include "string.h"

class string_wrapper;

string_wrapper Mid( const char *, int, int = -1 );
string_wrapper Mid( char *, int, int = -1 );

class string_wrapper {
public:
   string_wrapper( char * );
   string_wrapper( const string_wrapper &);
   ~string_wrapper();
   operator char *();
   string_wrapper &operator =(char *);
   string_wrapper &operator =(const string_wrapper &);
   void set_start( const unsigned int );
   void set_replacelen( const int );
   //not normally used
   void set_replaceptr( char * );
private:
   char *string;
   unsigned int replacestart;
   int replacelen;
   char *replaceptr;
};

void string_wrapper::set_replaceptr( char *strptr ) {
   replaceptr = strptr;
}

void string_wrapper::set_start( const unsigned int n ) {
   replacestart = n;
}

void string_wrapper::set_replacelen( const int i ) {
   replacelen = i;
}

string_wrapper::string_wrapper( char *initstring ) {
   if ( initstring == NULL )
      string = NULL;
   else {
      int len = strlen( initstring );
      string = new char[ len + 1 ];
      strcpy( string, initstring );
      string[ len ] = '\0';
   }
   replacestart = 0;
   replacelen = -1;
   replaceptr = NULL;
}

string_wrapper::string_wrapper(const string_wrapper &target) {
   if ( target.string == NULL )
      string = NULL;
   else {
      int len = strlen( target.string );
      string = new char[ len + 1 ];
      strcpy( string, target.string );
      string[ len ] = '\0';
   }
   replacestart = target.replacestart;
   replacelen = target.replacelen;
   replaceptr = target.replaceptr;
}

string_wrapper::~string_wrapper() {
   if ( string != NULL )
      delete [] string;
}

string_wrapper::operator char *() {
   return string;
}

string_wrapper &string_wrapper::operator =(const string_wrapper &target) {
   operator =( target.string );
   return *this;
}

string_wrapper &string_wrapper::operator =(char * newstr) {
   if ( newstr == NULL ) {
      if ( string != NULL )
         delete [] string;
      string = NULL;
   }
   else {
      if ( !replacestart ) {
         if ( string != NULL )
            delete [] string;
         string = new char[ strlen( newstr ) + 1 ];
         strcpy( string, newstr );
      }
      else {
         int len, targetlen;
         len = strlen( replaceptr );
         targetlen = strlen( newstr );
         if ( replacelen > targetlen )
            replacelen = targetlen;
         char *tmp = new char[ len + 1 ];
         strncpy( tmp, replaceptr, (replacestart - 1) );
         tmp[ replacestart - 1 ] = '\0';
         if ( replacelen == -1 )
            strncat( tmp, newstr, (len - replacestart + 1) );
         else {
            strncat( tmp, newstr, replacelen );
            strcat( tmp, (replaceptr + replacestart - 1 + replacelen ) );
         }
         tmp[ len ] = '\0';
         strcpy( replaceptr, tmp );
         strncpy( string, newstr, replacelen );
         delete [] tmp;
      }
   }
   replaceptr = NULL;
   replacestart = 0;
   replacelen = -1;
   return *this;
}

int main( int argc, char **argv ) { //Note the declaration of main
   //This demonstrates the use of Mid

   printf( "%s\n", (char *)Mid( "The middle of a string", 5, 6 ));
   //It requires a cast when the type is not explicit

   char str[] = "I'll replace \"bleh\" with \"test\"";
   Mid( str, 15, 4 ) = Mid( str, 1, 4 ) = "test";
   printf( "%s\n", str );

   return 0;
}

//Mid function
string_wrapper Mid( const char *lpszStr, int nStart, int nLength ) {
   if ( (nStart - 1) > strlen( lpszStr ) || nStart < 0 || nLength < 0 ) {
      string_wrapper blah1( "" );
      return blah1;
   }
   else {
   int newlen;
   if ( nLength == -1 )
      newlen = strlen( lpszStr ) - nStart + 1;
   else {
      if ( nLength > strlen( (lpszStr + nStart - 1) ) )
         newlen = strlen( lpszStr ) - nStart + 1;
      else newlen = nLength;
   }
   char *tmp = new char[ newlen + 1 ];
   strncpy( tmp, (lpszStr + nStart - 1), newlen );
   tmp[ newlen ] = '\0';
   string_wrapper blah( tmp );
   delete [] tmp;
   return blah;
   }
}

//Mid statement
string_wrapper Mid( char *lpszStr, int nStart, int nLength ) {
   if ( (nStart - 1) > strlen( lpszStr ) || nStart < 0 || nLength < 0 ) {
      string_wrapper blah1( "" );
      return blah1;
   }
   int newlen;
   if ( nLength == -1 )
      newlen = strlen( lpszStr ) - nStart + 1;
   else {
      if ( nLength > strlen( (lpszStr + nStart - 1) ) )
         newlen = strlen( lpszStr ) - nStart + 1;
      else newlen = nLength;
   }
   char *tmp = new char[ newlen + 1 ];
   strncpy( tmp, (lpszStr + nStart - 1), newlen );
   tmp[ newlen ] = '\0';
   string_wrapper blah( tmp );
   delete [] tmp;
   blah.set_start( nStart );
   blah.set_replacelen( nLength );
   blah.set_replaceptr( lpszStr );
   return blah;
}
#11
Fun Forum™ / Fun with hardware replacement
September 08, 2003, 05:10 PM


Here we are making sure my roommate's computer works after replacing his power supply. :)
#12
Excess of Grok / Pointless CS Assignments
April 03, 2003, 01:16 AM
Here's a little example of some Java code I had to write for a CS assignment recently:
abstract class FeatVal {
   protected Feature ofFeature;
   
   public FeatVal( Feature fFeature ) {
       ofFeature = fFeature;
   }
   
   public abstract double disSimilarity( FeatVal fFeatVal );
   abstract String getValString();
   
   public String toString() {
       String sRet = getValString() + " for " + ofFeature.toString();
       return sRet;
   }
}

class RealVal extends FeatVal {
   private double rVal;
   
   public RealVal( double dDouble, Feature fFeature ) {
       super( fFeature );
       rVal = dDouble;
       ((RealValFeature)ofFeature).newVal( rVal );
   }
   
   public double disSimilarity( FeatVal fRealVal ) {
       if ( this.rVal == ((RealVal)fRealVal).rVal )
           return 0.0;
       else {
           double dRet = (this.rVal - ((RealVal)fRealVal).rVal);
           dRet = dRet / (((RealValFeature)ofFeature).hiVal - ((RealValFeature)ofFeature).loVal);
           if ( dRet < 0 )
               dRet = dRet * -1;
           return dRet;
       }
   }
   
   String getValString() {
       return String.valueOf( rVal );
   }
}

class BoolVal extends FeatVal {
   private String bVal;
   
   public BoolVal( String sString, Feature fFeature ) {
       super( fFeature );
       bVal = sString;
   }
   
   public double disSimilarity( FeatVal fFeatVal ) {
       if ( this.bVal.compareTo( ((BoolVal)fFeatVal).bVal ) == 0 )
           return 0.0;
       else
           return 1.0;
   }
   
   String getValString() {
       return bVal;
   }
}


Now...I'm certainly not about to argue that inheritance and polymorphism are bad things (quite the opposite, in fact). But these two classes accomplish basicly the same thing as far as the concepts they're designed to demonstrate...and there were (!)5(!) more classes in a similar vein on this one assignment...all of which had to be done in order to get full credit.

What is it about CS professors that cause them to assign repetitive crap like this? Granted I came into my field with an advantage over many others, but anyone who has progressed to the class I'm currently in successfully is NOT going to need to repeat the same thing 6 times with subtle tweaks in order to learn it. Wouldn't the CS department be better served by covering more concepts, instead of trappling less concepts into the ground? Does this make sense to anybody else?
#13
Fun Forum™ / Clippy!
January 27, 2003, 03:10 PM
I had meant to bring this up when Yoni made the comment about there eventually being a program with a little clippy that said "hey, it looks like you're writing a bot" but I forgot about it...anyway, this is hilarious:

http://www.salmondays.tv/downloads/paper_clip.mpg